zkEVM node vs CDK validium node

zkevm-node version: v0.6.0

Files changed (85) hide show
  1. {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/aggregator.go +171 -35
  2. {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/aggregator_test.go +77 -7
  3. {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/config.go +23 -0
  4. {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/interfaces.go +1 -0
  5. {/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/approve.go +2 -2
  6. {/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/main.go +8 -1
  7. {/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/policy.go +308 -0
  8. {/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/run.go +143 -17
  9. {/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/set_data_availability_protocol.go +68 -0
  10. {/home/stefan/go/src/Polygon/zkevm-node → .}/config/cardonagenesis.go +0 -109
  11. {/home/stefan/go/src/Polygon/zkevm-node → .}/config/config.go +20 -1
  12. {/home/stefan/go/src/Polygon/zkevm-node → .}/config/config_test.go +16 -7
  13. {/home/stefan/go/src/Polygon/zkevm-node → .}/config/default.go +6 -0
  14. {/home/stefan/go/src/Polygon/zkevm-node → .}/config/mainnetgenesis.go +0 -108
  15. {/home/stefan/go/src/Polygon/zkevm-node → .}/config/network.go +9 -15
  16. {/home/stefan/go/src/Polygon/zkevm-node → .}/config/network_test.go +5 -15
  17. {/home/stefan/go/src/Polygon/zkevm-node → .}/config/testnetgenesis.go +0 -108
  18. {/home/stefan/go/src/Polygon/zkevm-node → .}/config/types/duration.go +10 -0
  19. {/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/config.go +9 -0
  20. {/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/dataavailability.go +183 -0
  21. {/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/datacommittee/datacommittee.go +309 -0
  22. {/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/datacommittee/datacommittee_test.go +131 -0
  23. {/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/interfaces.go +60 -0
  24. {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/pool/validium-001.sql +20 -0
  25. {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/validium-001.sql +32 -0
  26. {/home/stefan/go/src/Polygon/zkevm-node → .}/diffgen.sh +47 -0
  27. {/home/stefan/go/src/Polygon/zkevm-node → .}/Dockerfile +0 -1
  28. {/home/stefan/go/src/Polygon/zkevm-node → .}/Dockerfile.release +15 -0
  29. {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/etherman.go +283 -133
  30. {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/etherman_test.go +42 -31
  31. {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/interfaces.go +16 -0
  32. {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/simulated.go +27 -2
  33. {/home/stefan/go/src/Polygon/zkevm-node → .}/event/event.go +3 -0
  34. {/home/stefan/go/src/Polygon/zkevm-node → .}/.golangci.yml +3 -0
  35. {/home/stefan/go/src/Polygon/zkevm-node → .}/go.mod +9 -7
  36. {/home/stefan/go/src/Polygon/zkevm-node → .}/.goreleaser-cdk.yaml +84 -0
  37. {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/client/zkevm.go +40 -0
  38. {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/endpoints_eth.go +3 -0
  39. {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/endpoints_eth_test.go +235 -0
  40. {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/endpoints_zkevm.go +46 -0
  41. {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/endpoints_zkevm_test.go +24 -0
  42. {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/policy.go +61 -0
  43. {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/types/errors.go +2 -0
  44. {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/types/interfaces.go +3 -0
  45. {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/types/types.go +17 -0
  46. {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/errors.go +9 -0
  47. {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/interfaces.go +10 -0
  48. {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/pgpoolstorage/policy.go +202 -0
  49. {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/policy.go +43 -0
  50. {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/pool.go +12 -0
  51. {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/pool_test.go +66 -0
  52. {/home/stefan/go/src/Polygon/zkevm-node → .}/proto/src/proto/executor/v1/executor.proto +1 -0
  53. {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/finalizer.go +1 -0
  54. {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/l2block.go +2 -0
  55. {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/config.go +2 -0
  56. {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/interfaces.go +6 -2
  57. {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/sequencesender.go +15 -99
  58. {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/sequencesender_test.go +1 -1
  59. {/home/stefan/go/src/Polygon/zkevm-node → .}/state/batchV2.go +3 -0
  60. {/home/stefan/go/src/Polygon/zkevm-node → .}/state/genesis.go +4 -2
  61. {/home/stefan/go/src/Polygon/zkevm-node → .}/state/interfaces.go +3 -0
  62. {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/pgstatestorage.go +84 -0
  63. {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/pgstatestorage_test.go +109 -1
  64. {/home/stefan/go/src/Polygon/zkevm-node → .}/state/runtime/executor/client.go +7 -0
  65. {/home/stefan/go/src/Polygon/zkevm-node → .}/state/transaction.go +2 -0
  66. {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/elderberry/processor_l1_sequence_batches.go +5 -52
  67. {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l1_parallel_sync/l1_worker_etherman_test.go +1 -1
  68. {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/config.go +5 -0
  69. {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/l2_sync_etrog/executor_trusted_batch_sync.go +1 -0
  70. {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/l2_sync_incaberry/sync_trusted_state.go +1 -0
  71. {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/synchronizer.go +35 -5
  72. {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/synchronizer_test.go +8 -8
  73. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/auto/customModExp.sol +24 -0
  74. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/bin/customModExp/customModExp.go +224 -0
  75. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/bin/triggerErrors/triggerErrors.go +1 -1
  76. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/docker-compose.yml +51 -3
  77. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/datacommittee_test.go +270 -0
  78. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/forced_batches_test.go +1 -1
  79. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/forced_batches_vector_shared.go +2 -2
  80. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/state_test.go +1 -1
  81. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/Makefile +60 -16
  82. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/operations/manager.go +21 -1
  83. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/batchsender/main.go +2 -2
  84. {/home/stefan/go/src/Polygon/zkevm-node → .}/tools/state/main.go +1 -1
  85. {/home/stefan/go/src/Polygon/zkevm-node → .}/tools/state/reprocess_cmd.go +1 -1
{/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/aggregator.go RENAMED
@@ -2,6 +2,7 @@
2
 
3
  import (
4
  "context"
 
5
  "encoding/json"
6
  "errors"
7
  "fmt"
@@ -67,6 +71,9 @@
67
  srv *grpc.Server
68
  ctx context.Context
69
  exit context.CancelFunc
 
 
 
70
  }
71
 
72
  // New creates a new aggregator.
@@ -75,6 +82,8 @@
75
  stateInterface stateInterface,
76
  ethTxManager ethTxManager,
77
  etherman etherman,
 
 
78
  ) (Aggregator, error) {
79
  var profitabilityChecker aggregatorTxProfitabilityChecker
80
  switch cfg.TxProfitabilityCheckerType {
@@ -96,6 +105,9 @@
96
  TimeCleanupLockedProofs: cfg.CleanupLockedProofsInterval,
97
 
98
  finalProof: make(chan finalProofMsg),
 
 
 
99
  }
100
 
101
  return a, nil
@@ -215,6 +227,11 @@
215
  _, err = a.tryBuildFinalProof(ctx, prover, nil)
216
  if err != nil {
217
  log.Errorf("Error checking proofs to verify: %v", err)
 
 
 
 
 
218
  }
219
 
220
  proofGenerated, err := a.tryAggregateProofs(ctx, prover)
@@ -269,34 +286,139 @@
269
 
270
  log.Infof("Final proof inputs: NewLocalExitRoot [%#x], NewStateRoot [%#x]", inputs.NewLocalExitRoot, inputs.NewStateRoot)
271
 
272
- // add batch verification to be monitored
273
- sender := common.HexToAddress(a.cfg.SenderAddress)
274
- to, data, err := a.Ethman.BuildTrustedVerifyBatchesTxData(proof.BatchNumber-1, proof.BatchNumberFinal, &inputs, sender)
275
- if err != nil {
276
- log.Errorf("Error estimating batch verification to add to eth tx manager: %v", err)
277
- a.handleFailureToAddVerifyBatchToBeMonitored(ctx, proof)
278
- continue
279
- }
280
- monitoredTxID := buildMonitoredTxID(proof.BatchNumber, proof.BatchNumberFinal)
281
- err = a.EthTxManager.Add(ctx, ethTxManagerOwner, monitoredTxID, sender, to, nil, data, a.cfg.GasOffset, nil)
282
- if err != nil {
283
- mTxLogger := ethtxmanager.CreateLogger(ethTxManagerOwner, monitoredTxID, sender, to)
284
- mTxLogger.Errorf("Error to add batch verification tx to eth tx manager: %v", err)
285
- a.handleFailureToAddVerifyBatchToBeMonitored(ctx, proof)
286
- continue
287
  }
288
 
289
- // process monitored batch verifications before starting a next cycle
290
- a.EthTxManager.ProcessPendingMonitoredTxs(ctx, ethTxManagerOwner, func(result ethtxmanager.MonitoredTxResult, dbTx pgx.Tx) {
291
- a.handleMonitoredTxResult(result)
292
- }, nil)
293
-
294
  a.resetVerifyProofTime()
295
  a.endProofVerification()
296
  }
297
  }
298
  }
299
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
  func (a *Aggregator) handleFailureToAddVerifyBatchToBeMonitored(ctx context.Context, proof *state.Proof) {
301
  log := log.WithFields("proofId", proof.ProofID, "batches", fmt.Sprintf("%d-%d", proof.BatchNumber, proof.BatchNumberFinal))
302
  proof.GeneratingSince = nil
@@ -373,10 +495,9 @@
373
  }
374
  log.Debug("Send final proof time reached")
375
 
376
- for !a.isSynced(ctx, nil) {
377
- log.Info("Waiting for synchronizer to sync...")
378
- time.Sleep(a.cfg.RetryTime.Duration)
379
- continue
380
  }
381
 
382
  var lastVerifiedBatchNum uint64
@@ -952,41 +1073,41 @@
952
 
953
  // isSynced checks if the state is synchronized with L1. If a batch number is
954
  // provided, it makes sure that the state is synced with that batch.
955
- func (a *Aggregator) isSynced(ctx context.Context, batchNum *uint64) bool {
956
  // get latest verified batch as seen by the synchronizer
957
  lastVerifiedBatch, err := a.State.GetLastVerifiedBatch(ctx, nil)
958
  if err == state.ErrNotFound {
959
- return false
960
  }
961
  if err != nil {
962
  log.Warnf("Failed to get last consolidated batch: %v", err)
963
- return false
964
  }
965
 
966
  if lastVerifiedBatch == nil {
967
- return false
968
  }
969
 
970
  if batchNum != nil && lastVerifiedBatch.BatchNumber < *batchNum {
971
  log.Infof("Waiting for the state to be synced, lastVerifiedBatchNum: %d, waiting for batch: %d", lastVerifiedBatch.BatchNumber, batchNum)
972
- return false
973
  }
974
 
975
  // latest verified batch in L1
976
  lastVerifiedEthBatchNum, err := a.Ethman.GetLatestVerifiedBatchNum()
977
  if err != nil {
978
  log.Warnf("Failed to get last eth batch, err: %v", err)
979
- return false
980
  }
981
 
982
  // check if L2 is synced with L1
983
  if lastVerifiedBatch.BatchNumber < lastVerifiedEthBatchNum {
984
  log.Infof("Waiting for the state to be synced, lastVerifiedBatchNum: %d, lastVerifiedEthBatchNum: %d, waiting for batch",
985
  lastVerifiedBatch.BatchNumber, lastVerifiedEthBatchNum)
986
- return false
987
  }
988
 
989
- return true
990
  }
991
 
992
  func (a *Aggregator) buildInputProver(ctx context.Context, batchToVerify *state.Batch) (*prover.InputProver, error) {
@@ -1180,9 +1301,9 @@
1180
 
1181
  // wait for the synchronizer to catch up the verified batches
1182
  log.Debug("A final proof has been sent, waiting for the network to be synced")
1183
- for !a.isSynced(a.ctx, &proofBatchNumberFinal) {
1184
- log.Info("Waiting for synchronizer to sync...")
1185
- time.Sleep(a.cfg.RetryTime.Duration)
1186
  }
1187
 
1188
  // network is synced with the final proof, we can safely delete all recursive
@@ -1193,6 +1314,24 @@
1193
  }
1194
  }
1195
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1196
  func buildMonitoredTxID(batchNumber, batchNumberFinal uint64) string {
1197
  return fmt.Sprintf(monitoredIDFormat, batchNumber, batchNumberFinal)
1198
  }
 
2
 
3
  import (
4
  "context"
5
+ "crypto/ecdsa"
6
  "encoding/json"
7
  "errors"
8
  "fmt"
 
71
  srv *grpc.Server
72
  ctx context.Context
73
  exit context.CancelFunc
74
+
75
+ AggLayerClient client.ClientInterface
76
+ sequencerPrivateKey *ecdsa.PrivateKey
77
  }
78
 
79
  // New creates a new aggregator.
 
82
  stateInterface stateInterface,
83
  ethTxManager ethTxManager,
84
  etherman etherman,
85
+ agglayerClient client.ClientInterface,
86
+ sequencerPrivateKey *ecdsa.PrivateKey,
87
  ) (Aggregator, error) {
88
  var profitabilityChecker aggregatorTxProfitabilityChecker
89
  switch cfg.TxProfitabilityCheckerType {
 
105
  TimeCleanupLockedProofs: cfg.CleanupLockedProofsInterval,
106
 
107
  finalProof: make(chan finalProofMsg),
108
+
109
+ AggLayerClient: agglayerClient,
110
+ sequencerPrivateKey: sequencerPrivateKey,
111
  }
112
 
113
  return a, nil
 
227
  _, err = a.tryBuildFinalProof(ctx, prover, nil)
228
  if err != nil {
229
  log.Errorf("Error checking proofs to verify: %v", err)
230
+
231
+ if errors.Is(err, context.Canceled) {
232
+ // the context was canceled, just continue, the loop will stop in the <-ctx.Done() case
233
+ continue
234
+ }
235
  }
236
 
237
  proofGenerated, err := a.tryAggregateProofs(ctx, prover)
 
286
 
287
  log.Infof("Final proof inputs: NewLocalExitRoot [%#x], NewStateRoot [%#x]", inputs.NewLocalExitRoot, inputs.NewStateRoot)
288
 
289
+ switch a.cfg.SettlementBackend {
290
+ case AggLayer:
291
+ if success := a.settleWithAggLayer(ctx, proof, inputs); !success {
292
+ continue
293
+ }
294
+ default:
295
+ if success := a.settleDirect(ctx, proof, inputs); !success {
296
+ continue
297
+ }
 
 
 
 
 
 
298
  }
299
 
 
 
 
 
 
300
  a.resetVerifyProofTime()
301
  a.endProofVerification()
302
  }
303
  }
304
  }
305
 
306
+ func (a *Aggregator) settleDirect(
307
+ ctx context.Context,
308
+ proof *state.Proof,
309
+ inputs ethmanTypes.FinalProofInputs,
310
+ ) (success bool) {
311
+ // add batch verification to be monitored
312
+ sender := common.HexToAddress(a.cfg.SenderAddress)
313
+
314
+ to, data, err := a.Ethman.BuildTrustedVerifyBatchesTxData(
315
+ proof.BatchNumber-1,
316
+ proof.BatchNumberFinal,
317
+ &inputs,
318
+ sender,
319
+ )
320
+ if err != nil {
321
+ log.Errorf("Error estimating batch verification to add to eth tx manager: %v", err)
322
+ a.handleFailureToAddVerifyBatchToBeMonitored(ctx, proof)
323
+
324
+ return false
325
+ }
326
+
327
+ monitoredTxID := buildMonitoredTxID(proof.BatchNumber, proof.BatchNumberFinal)
328
+ err = a.EthTxManager.Add(
329
+ ctx,
330
+ ethTxManagerOwner,
331
+ monitoredTxID,
332
+ sender,
333
+ to,
334
+ nil,
335
+ data,
336
+ a.cfg.GasOffset,
337
+ nil,
338
+ )
339
+ if err != nil {
340
+ mTxLogger := ethtxmanager.CreateLogger(ethTxManagerOwner, monitoredTxID, sender, to)
341
+ mTxLogger.Errorf("Error to add batch verification tx to eth tx manager: %v", err)
342
+ a.handleFailureToAddVerifyBatchToBeMonitored(ctx, proof)
343
+
344
+ return false
345
+ }
346
+
347
+ // process monitored batch verifications before starting a next cycle
348
+ a.EthTxManager.ProcessPendingMonitoredTxs(
349
+ ctx,
350
+ ethTxManagerOwner,
351
+ func(result ethtxmanager.MonitoredTxResult, dbTx pgx.Tx) {
352
+ a.handleMonitoredTxResult(result)
353
+ },
354
+ nil,
355
+ )
356
+
357
+ return true
358
+ }
359
+
360
+ func (a *Aggregator) settleWithAggLayer(
361
+ ctx context.Context,
362
+ proof *state.Proof,
363
+ inputs ethmanTypes.FinalProofInputs,
364
+ ) (success bool) {
365
+ proofStrNo0x := strings.TrimPrefix(inputs.FinalProof.Proof, "0x")
366
+ proofBytes := common.Hex2Bytes(proofStrNo0x)
367
+ tx := tx.Tx{
368
+ LastVerifiedBatch: agglayerTypes.ArgUint64(proof.BatchNumber - 1),
369
+ NewVerifiedBatch: agglayerTypes.ArgUint64(proof.BatchNumberFinal),
370
+ ZKP: tx.ZKP{
371
+ NewStateRoot: common.BytesToHash(inputs.NewStateRoot),
372
+ NewLocalExitRoot: common.BytesToHash(inputs.NewLocalExitRoot),
373
+ Proof: agglayerTypes.ArgBytes(proofBytes),
374
+ },
375
+ RollupID: a.Ethman.GetRollupId(),
376
+ }
377
+ signedTx, err := tx.Sign(a.sequencerPrivateKey)
378
+
379
+ if err != nil {
380
+ log.Errorf("failed to sign tx: %v", err)
381
+ a.handleFailureToSendToAggLayer(ctx, proof)
382
+
383
+ return false
384
+ }
385
+
386
+ log.Debug("final proof signedTx: ", signedTx.Tx.ZKP.Proof.Hex())
387
+ txHash, err := a.AggLayerClient.SendTx(*signedTx)
388
+ if err != nil {
389
+ log.Errorf("failed to send tx to the interop: %v", err)
390
+ a.handleFailureToSendToAggLayer(ctx, proof)
391
+
392
+ return false
393
+ }
394
+
395
+ log.Infof("tx %s sent to agglayer, waiting to be mined", txHash.Hex())
396
+ log.Debugf("Timeout set to %f seconds", a.cfg.AggLayerTxTimeout.Duration.Seconds())
397
+ waitCtx, cancelFunc := context.WithDeadline(ctx, time.Now().Add(a.cfg.AggLayerTxTimeout.Duration))
398
+ defer cancelFunc()
399
+ if err := a.AggLayerClient.WaitTxToBeMined(txHash, waitCtx); err != nil {
400
+ log.Errorf("interop didn't mine the tx: %v", err)
401
+ a.handleFailureToSendToAggLayer(ctx, proof)
402
+
403
+ return false
404
+ }
405
+
406
+ // TODO: wait for synchronizer to catch up
407
+ return true
408
+ }
409
+
410
+ func (a *Aggregator) handleFailureToSendToAggLayer(ctx context.Context, proof *state.Proof) {
411
+ log := log.WithFields("proofId", proof.ProofID, "batches", fmt.Sprintf("%d-%d", proof.BatchNumber, proof.BatchNumberFinal))
412
+ proof.GeneratingSince = nil
413
+
414
+ err := a.State.UpdateGeneratedProof(ctx, proof, nil)
415
+ if err != nil {
416
+ log.Errorf("Failed updating proof state (false): %v", err)
417
+ }
418
+
419
+ a.endProofVerification()
420
+ }
421
+
422
  func (a *Aggregator) handleFailureToAddVerifyBatchToBeMonitored(ctx context.Context, proof *state.Proof) {
423
  log := log.WithFields("proofId", proof.ProofID, "batches", fmt.Sprintf("%d-%d", proof.BatchNumber, proof.BatchNumberFinal))
424
  proof.GeneratingSince = nil
 
495
  }
496
  log.Debug("Send final proof time reached")
497
 
498
+ if err = a.waitForSynchronizerToSyncUp(ctx, nil); err != nil {
499
+ log.Warn("waiting for the synchronizer to sync up was canceled", err)
500
+ return false, err
 
501
  }
502
 
503
  var lastVerifiedBatchNum uint64
 
1073
 
1074
  // isSynced checks if the state is synchronized with L1. If a batch number is
1075
  // provided, it makes sure that the state is synced with that batch.
1076
+ func (a *Aggregator) isSynced(ctx context.Context, batchNum *uint64) (bool, error) {
1077
  // get latest verified batch as seen by the synchronizer
1078
  lastVerifiedBatch, err := a.State.GetLastVerifiedBatch(ctx, nil)
1079
  if err == state.ErrNotFound {
1080
+ return false, nil
1081
  }
1082
  if err != nil {
1083
  log.Warnf("Failed to get last consolidated batch: %v", err)
1084
+ return false, err
1085
  }
1086
 
1087
  if lastVerifiedBatch == nil {
1088
+ return false, nil
1089
  }
1090
 
1091
  if batchNum != nil && lastVerifiedBatch.BatchNumber < *batchNum {
1092
  log.Infof("Waiting for the state to be synced, lastVerifiedBatchNum: %d, waiting for batch: %d", lastVerifiedBatch.BatchNumber, batchNum)
1093
+ return false, nil
1094
  }
1095
 
1096
  // latest verified batch in L1
1097
  lastVerifiedEthBatchNum, err := a.Ethman.GetLatestVerifiedBatchNum()
1098
  if err != nil {
1099
  log.Warnf("Failed to get last eth batch, err: %v", err)
1100
+ return false, err
1101
  }
1102
 
1103
  // check if L2 is synced with L1
1104
  if lastVerifiedBatch.BatchNumber < lastVerifiedEthBatchNum {
1105
  log.Infof("Waiting for the state to be synced, lastVerifiedBatchNum: %d, lastVerifiedEthBatchNum: %d, waiting for batch",
1106
  lastVerifiedBatch.BatchNumber, lastVerifiedEthBatchNum)
1107
+ return false, nil
1108
  }
1109
 
1110
+ return true, nil
1111
  }
1112
 
1113
  func (a *Aggregator) buildInputProver(ctx context.Context, batchToVerify *state.Batch) (*prover.InputProver, error) {
 
1301
 
1302
  // wait for the synchronizer to catch up the verified batches
1303
  log.Debug("A final proof has been sent, waiting for the network to be synced")
1304
+ if err := a.waitForSynchronizerToSyncUp(a.ctx, &proofBatchNumberFinal); err != nil {
1305
+ log.Warn("waiting for the synchronizer to sync up was canceled", err)
1306
+ return
1307
  }
1308
 
1309
  // network is synced with the final proof, we can safely delete all recursive
 
1314
  }
1315
  }
1316
 
1317
+ func (a *Aggregator) waitForSynchronizerToSyncUp(ctx context.Context, batchNum *uint64) error {
1318
+ for {
1319
+ log.Info("waiting for the synchronizer to sync...")
1320
+ synced, err := a.isSynced(ctx, batchNum)
1321
+ if err != nil && errors.Is(err, context.Canceled) {
1322
+ // if context is canceled, stop the loop, since it will never
1323
+ // be able to execute properly and break in this case, and we will be stuck in it forever
1324
+ return err
1325
+ }
1326
+
1327
+ if synced {
1328
+ return nil
1329
+ }
1330
+
1331
+ time.Sleep(a.cfg.RetryTime.Duration)
1332
+ }
1333
+ }
1334
+
1335
  func buildMonitoredTxID(batchNumber, batchNumberFinal uint64) string {
1336
  return fmt.Sprintf(monitoredIDFormat, batchNumber, batchNumberFinal)
1337
  }
{/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/aggregator_test.go RENAMED
@@ -191,7 +191,7 @@
191
  stateMock := mocks.NewStateMock(t)
192
  ethTxManager := mocks.NewEthTxManager(t)
193
  etherman := mocks.NewEtherman(t)
194
- a, err := New(cfg, stateMock, ethTxManager, etherman)
195
  require.NoError(err)
196
  a.ctx, a.exit = context.WithCancel(context.Background())
197
  m := mox{
@@ -686,7 +686,7 @@
686
  ethTxManager := mocks.NewEthTxManager(t)
687
  etherman := mocks.NewEtherman(t)
688
  proverMock := mocks.NewProverMock(t)
689
- a, err := New(cfg, stateMock, ethTxManager, etherman)
690
  require.NoError(err)
691
  aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
692
  a.ctx, a.exit = context.WithCancel(aggregatorCtx)
@@ -1029,7 +1029,7 @@
1029
  ethTxManager := mocks.NewEthTxManager(t)
1030
  etherman := mocks.NewEtherman(t)
1031
  proverMock := mocks.NewProverMock(t)
1032
- a, err := New(cfg, stateMock, ethTxManager, etherman)
1033
  require.NoError(err)
1034
  aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
1035
  a.ctx, a.exit = context.WithCancel(aggregatorCtx)
@@ -1306,7 +1306,7 @@
1306
  ethTxManager := mocks.NewEthTxManager(t)
1307
  etherman := mocks.NewEtherman(t)
1308
  proverMock := mocks.NewProverMock(t)
1309
- a, err := New(cfg, stateMock, ethTxManager, etherman)
1310
  require.NoError(err)
1311
  aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
1312
  a.ctx, a.exit = context.WithCancel(aggregatorCtx)
@@ -1436,7 +1436,7 @@
1436
  ethTxManager := mocks.NewEthTxManager(t)
1437
  etherman := mocks.NewEtherman(t)
1438
  proverMock := mocks.NewProverMock(t)
1439
- a, err := New(cfg, stateMock, ethTxManager, etherman)
1440
  require.NoError(err)
1441
  aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
1442
  a.ctx, a.exit = context.WithCancel(aggregatorCtx)
@@ -1450,9 +1450,79 @@
1450
  tc.setup(m, &a)
1451
  }
1452
 
1453
- synced := a.isSynced(a.ctx, tc.batchNum)
1454
-
1455
  assert.Equal(tc.synced, synced)
1456
  })
1457
  }
1458
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  stateMock := mocks.NewStateMock(t)
192
  ethTxManager := mocks.NewEthTxManager(t)
193
  etherman := mocks.NewEtherman(t)
194
+ a, err := New(cfg, stateMock, ethTxManager, etherman, nil, nil)
195
  require.NoError(err)
196
  a.ctx, a.exit = context.WithCancel(context.Background())
197
  m := mox{
 
686
  ethTxManager := mocks.NewEthTxManager(t)
687
  etherman := mocks.NewEtherman(t)
688
  proverMock := mocks.NewProverMock(t)
689
+ a, err := New(cfg, stateMock, ethTxManager, etherman, nil, nil)
690
  require.NoError(err)
691
  aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
692
  a.ctx, a.exit = context.WithCancel(aggregatorCtx)
 
1029
  ethTxManager := mocks.NewEthTxManager(t)
1030
  etherman := mocks.NewEtherman(t)
1031
  proverMock := mocks.NewProverMock(t)
1032
+ a, err := New(cfg, stateMock, ethTxManager, etherman, nil, nil)
1033
  require.NoError(err)
1034
  aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
1035
  a.ctx, a.exit = context.WithCancel(aggregatorCtx)
 
1306
  ethTxManager := mocks.NewEthTxManager(t)
1307
  etherman := mocks.NewEtherman(t)
1308
  proverMock := mocks.NewProverMock(t)
1309
+ a, err := New(cfg, stateMock, ethTxManager, etherman, nil, nil)
1310
  require.NoError(err)
1311
  aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
1312
  a.ctx, a.exit = context.WithCancel(aggregatorCtx)
 
1436
  ethTxManager := mocks.NewEthTxManager(t)
1437
  etherman := mocks.NewEtherman(t)
1438
  proverMock := mocks.NewProverMock(t)
1439
+ a, err := New(cfg, stateMock, ethTxManager, etherman, nil, nil)
1440
  require.NoError(err)
1441
  aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
1442
  a.ctx, a.exit = context.WithCancel(aggregatorCtx)
 
1450
  tc.setup(m, &a)
1451
  }
1452
 
1453
+ synced, _ := a.isSynced(a.ctx, tc.batchNum)
 
1454
  assert.Equal(tc.synced, synced)
1455
  })
1456
  }
1457
  }
1458
+
1459
+ func TestWaitForSynchronizerToSyncUp(t *testing.T) {
1460
+ t.Parallel()
1461
+
1462
+ cfg := Config{}
1463
+ batchNum := uint64(42)
1464
+ testCases := []struct {
1465
+ name string
1466
+ setup func(mox, *Aggregator)
1467
+ batchNum *uint64
1468
+ synced bool
1469
+ }{
1470
+ {
1471
+ name: "state context canceled",
1472
+ synced: false,
1473
+ batchNum: &batchNum,
1474
+ setup: func(m mox, a *Aggregator) {
1475
+ m.stateMock.On("GetLastVerifiedBatch", mock.Anything, nil).Return(nil, context.Canceled).Once()
1476
+ },
1477
+ },
1478
+ {
1479
+ name: "ok after multiple iterations",
1480
+ synced: true,
1481
+ batchNum: &batchNum,
1482
+ setup: func(m mox, a *Aggregator) {
1483
+ latestVerifiedBatch := state.VerifiedBatch{BatchNumber: batchNum}
1484
+ m.stateMock.On("GetLastVerifiedBatch", mock.Anything, nil).Return(nil, nil).Once()
1485
+ m.stateMock.On("GetLastVerifiedBatch", mock.Anything, nil).Return(&latestVerifiedBatch, nil).Once()
1486
+ m.etherman.On("GetLatestVerifiedBatchNum").Return(batchNum, nil).Once()
1487
+ },
1488
+ },
1489
+ {
1490
+ name: "ok with batch number",
1491
+ synced: true,
1492
+ batchNum: &batchNum,
1493
+ setup: func(m mox, a *Aggregator) {
1494
+ latestVerifiedBatch := state.VerifiedBatch{BatchNumber: batchNum}
1495
+ m.stateMock.On("GetLastVerifiedBatch", mock.Anything, nil).Return(&latestVerifiedBatch, nil).Once()
1496
+ m.etherman.On("GetLatestVerifiedBatchNum").Return(batchNum, nil).Once()
1497
+ },
1498
+ },
1499
+ }
1500
+ for _, tc := range testCases {
1501
+ t.Run(tc.name, func(t *testing.T) {
1502
+ stateMock := mocks.NewStateMock(t)
1503
+ ethTxManager := mocks.NewEthTxManager(t)
1504
+ etherman := mocks.NewEtherman(t)
1505
+ proverMock := mocks.NewProverMock(t)
1506
+ a, err := New(cfg, stateMock, ethTxManager, etherman, nil, nil)
1507
+ require.NoError(t, err)
1508
+ aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
1509
+ a.ctx, a.exit = context.WithCancel(aggregatorCtx)
1510
+ m := mox{
1511
+ stateMock: stateMock,
1512
+ ethTxManager: ethTxManager,
1513
+ etherman: etherman,
1514
+ proverMock: proverMock,
1515
+ }
1516
+ if tc.setup != nil {
1517
+ tc.setup(m, &a)
1518
+ }
1519
+
1520
+ err = a.waitForSynchronizerToSyncUp(a.ctx, tc.batchNum)
1521
+ if tc.synced {
1522
+ assert.NoError(t, err)
1523
+ } else {
1524
+ assert.Error(t, err)
1525
+ }
1526
+ })
1527
+ }
1528
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/config.go RENAMED
@@ -8,6 +8,17 @@
8
  "github.com/0xPolygonHermez/zkevm-node/encoding"
9
  )
10
 
 
 
 
 
 
 
 
 
 
 
 
11
  // TokenAmountWithDecimals is a wrapper type that parses token amount with decimals to big int
12
  type TokenAmountWithDecimals struct {
13
  *big.Int `validate:"required"`
@@ -89,6 +100,18 @@
89
  // UpgradeEtrogBatchNumber is the number of the first batch after upgrading to etrog
90
  UpgradeEtrogBatchNumber uint64 `mapstructure:"UpgradeEtrogBatchNumber"`
91
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  // BatchProofL1BlockConfirmations is number of L1 blocks to consider we can generate the proof for a virtual batch
93
  BatchProofL1BlockConfirmations uint64 `mapstructure:"BatchProofL1BlockConfirmations"`
94
  }
 
8
  "github.com/0xPolygonHermez/zkevm-node/encoding"
9
  )
10
 
11
+ // SettlementBackend is the type of the settlement backend
12
+ type SettlementBackend string
13
+
14
+ const (
15
+ // AggLayer settlement backend
16
+ AggLayer SettlementBackend = "agglayer"
17
+
18
+ // L1 settlement backend
19
+ L1 SettlementBackend = "l1"
20
+ )
21
+
22
  // TokenAmountWithDecimals is a wrapper type that parses token amount with decimals to big int
23
  type TokenAmountWithDecimals struct {
24
  *big.Int `validate:"required"`
 
100
  // UpgradeEtrogBatchNumber is the number of the first batch after upgrading to etrog
101
  UpgradeEtrogBatchNumber uint64 `mapstructure:"UpgradeEtrogBatchNumber"`
102
 
103
+ // SettlementBackend configuration defines how a final ZKP should be settled. Directly to L1 or over the Beethoven service.
104
+ SettlementBackend SettlementBackend `mapstructure:"SettlementBackend"`
105
+
106
+ // AggLayerTxTimeout is the interval time to wait for a tx to be mined from the agglayer
107
+ AggLayerTxTimeout types.Duration `mapstructure:"AggLayerTxTimeout"`
108
+
109
+ // AggLayerURL url of the agglayer service
110
+ AggLayerURL string `mapstructure:"AggLayerURL"`
111
+
112
+ // SequencerPrivateKey Private key of the trusted sequencer
113
+ SequencerPrivateKey types.KeystoreFileConfig `mapstructure:"SequencerPrivateKey"`
114
+
115
  // BatchProofL1BlockConfirmations is number of L1 blocks to consider we can generate the proof for a virtual batch
116
  BatchProofL1BlockConfirmations uint64 `mapstructure:"BatchProofL1BlockConfirmations"`
117
  }
{/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/interfaces.go RENAMED
@@ -38,6 +38,7 @@
38
 
39
  // etherman contains the methods required to interact with ethereum
40
  type etherman interface {
 
41
  GetLatestVerifiedBatchNum() (uint64, error)
42
  BuildTrustedVerifyBatchesTxData(lastVerifiedBatch, newVerifiedBatch uint64, inputs *ethmanTypes.FinalProofInputs, beneficiary common.Address) (to *common.Address, data []byte, err error)
43
  GetLatestBlockHeader(ctx context.Context) (*types.Header, error)
 
38
 
39
  // etherman contains the methods required to interact with ethereum
40
  type etherman interface {
41
+ GetRollupId() uint32
42
  GetLatestVerifiedBatchNum() (uint64, error)
43
  BuildTrustedVerifyBatchesTxData(lastVerifiedBatch, newVerifiedBatch uint64, inputs *ethmanTypes.FinalProofInputs, beneficiary common.Address) (to *common.Address, data []byte, err error)
44
  GetLatestBlockHeader(ctx context.Context) (*types.Header, error)
{/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/approve.go RENAMED
@@ -51,14 +51,14 @@
51
  setupLog(c.Log)
52
 
53
  // Check if it is already registered
54
- etherman, err := newEtherman(*c)
55
  if err != nil {
56
  log.Fatal(err)
57
  return err
58
  }
59
 
60
  // load auth from keystore file
61
- auth, err := etherman.LoadAuthFromKeyStore(addrKeyStorePath, addrPassword)
62
  if err != nil {
63
  log.Fatal(err)
64
  return err
 
51
  setupLog(c.Log)
52
 
53
  // Check if it is already registered
54
+ etherman, err := newEtherman(*c, nil)
55
  if err != nil {
56
  log.Fatal(err)
57
  return err
58
  }
59
 
60
  // load auth from keystore file
61
+ auth, _, err := etherman.LoadAuthFromKeyStore(addrKeyStorePath, addrPassword)
62
  if err != nil {
63
  log.Fatal(err)
64
  return err
{/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/main.go RENAMED
@@ -47,7 +47,7 @@
47
  networkFlag = cli.StringFlag{
48
  Name: config.FlagNetwork,
49
  Aliases: []string{"net"},
50
- Usage: "Load default network configuration. Supported values: [`mainnet`, `testnet`, `cardona`, `custom`]",
51
  Required: true,
52
  }
53
  customNetworkFlag = cli.StringFlag{
@@ -186,6 +186,13 @@
186
  Action: restore,
187
  Flags: restoreFlags,
188
  },
 
 
 
 
 
 
 
189
  }
190
 
191
  err := app.Run(os.Args)
 
47
  networkFlag = cli.StringFlag{
48
  Name: config.FlagNetwork,
49
  Aliases: []string{"net"},
50
+ Usage: "Load default network configuration. Supported values: [`custom`]",
51
  Required: true,
52
  }
53
  customNetworkFlag = cli.StringFlag{
 
186
  Action: restore,
187
  Flags: restoreFlags,
188
  },
189
+ {
190
+ Name: "set-data-availability-protocol",
191
+ Aliases: []string{"set-dap"},
192
+ Usage: "Sets the new data availability protocol",
193
+ Action: setDataAvailabilityProtocol,
194
+ Flags: setDataAvailabilityProtocolFlags,
195
+ },
196
  }
197
 
198
  err := app.Run(os.Args)
{/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/policy.go RENAMED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package main
2
+
3
+ import (
4
+ "context"
5
+ "encoding/csv"
6
+ "errors"
7
+ "fmt"
8
+ "os"
9
+ "strings"
10
+
11
+ "github.com/0xPolygonHermez/zkevm-node/config"
12
+ "github.com/0xPolygonHermez/zkevm-node/pool"
13
+ "github.com/0xPolygonHermez/zkevm-node/pool/pgpoolstorage"
14
+ "github.com/ethereum/go-ethereum/common"
15
+ "github.com/urfave/cli/v2"
16
+ )
17
+
18
+ var (
19
+ policyFlag = cli.StringFlag{
20
+ Name: "policy",
21
+ Aliases: []string{"p"},
22
+ Usage: "Name of policy to operate on",
23
+ Required: false,
24
+ }
25
+ csvFlag = cli.StringFlag{
26
+ Name: "csv",
27
+ Usage: "CSV file with addresses",
28
+ Required: false,
29
+ }
30
+ allowFlag = cli.BoolFlag{
31
+ Name: "allow",
32
+ Usage: "Update policy to 'allow' addresses on list",
33
+ Required: false,
34
+ }
35
+ denyFlag = cli.BoolFlag{
36
+ Name: "deny",
37
+ Usage: "Update policy to 'deny' addresses on list",
38
+ Required: false,
39
+ }
40
+ noHeaderFlag = cli.BoolFlag{
41
+ Name: "no-header",
42
+ Value: false,
43
+ Required: false,
44
+ }
45
+
46
+ policyActionFlags = []cli.Flag{&policyFlag}
47
+ )
48
+
49
+ var policyCommands = cli.Command{
50
+ Name: "policy",
51
+ Usage: "View, update, and apply policies",
52
+ Action: describe,
53
+ Flags: []cli.Flag{&configFileFlag},
54
+ Subcommands: []*cli.Command{
55
+ {
56
+ Name: "add",
57
+ Usage: "Add address(es) to a policy exclusion list",
58
+ Action: addAcl,
59
+ Flags: append(policyActionFlags, &csvFlag),
60
+ }, {
61
+ Name: "clear",
62
+ Usage: "Clear the addresses listed as exceptions to a policy",
63
+ Action: clearAcl,
64
+ Flags: policyActionFlags,
65
+ }, {
66
+ Name: "describe",
67
+ Usage: "Describe the default actions for the policies",
68
+ Action: describe,
69
+ Flags: append(policyActionFlags, &noHeaderFlag),
70
+ }, {
71
+ Name: "remove",
72
+ Usage: "Remove address(es) from a policy exclusion list",
73
+ Action: removeAcl,
74
+ Flags: append(policyActionFlags, &csvFlag),
75
+ }, {
76
+ Name: "update",
77
+ Usage: "Update the default action for a policy",
78
+ Action: updatePolicy,
79
+ Flags: append(policyActionFlags, &allowFlag, &denyFlag),
80
+ },
81
+ },
82
+ }
83
+
84
+ func updatePolicy(cli *cli.Context) error {
85
+ _, db, err := configAndStorage(cli)
86
+ if err != nil {
87
+ return err
88
+ }
89
+ policy, err := resolvePolicy(cli)
90
+ if err != nil {
91
+ return err
92
+ }
93
+
94
+ allow := cli.Bool(allowFlag.Name)
95
+ deny := cli.Bool(denyFlag.Name)
96
+
97
+ // exactly one must be set
98
+ if (allow && deny) || (!allow && !deny) {
99
+ return errors.New("supply one policy action [--allow or --deny]")
100
+ }
101
+
102
+ var setting bool
103
+ if allow {
104
+ setting = true
105
+ } else if deny {
106
+ setting = false
107
+ }
108
+
109
+ err = db.UpdatePolicy(context.Background(), policy, setting)
110
+ if err != nil {
111
+ return err
112
+ }
113
+ return nil
114
+ }
115
+
116
+ func addAcl(cli *cli.Context) error {
117
+ _, db, err := configAndStorage(cli)
118
+ if err != nil {
119
+ return err
120
+ }
121
+ policy, addresses, err := requirePolicyAndAddresses(cli)
122
+ if err != nil {
123
+ return err
124
+ }
125
+ err = db.AddAddressesToPolicy(context.Background(), policy, addresses)
126
+ if err != nil {
127
+ return err
128
+ }
129
+ return nil
130
+ }
131
+
132
+ func removeAcl(cli *cli.Context) error {
133
+ _, db, err := configAndStorage(cli)
134
+ if err != nil {
135
+ return err
136
+ }
137
+ policy, addresses, err := requirePolicyAndAddresses(cli)
138
+ if err != nil {
139
+ return err
140
+ }
141
+ err = db.RemoveAddressesFromPolicy(context.Background(), policy, addresses)
142
+ if err != nil {
143
+ return err
144
+ }
145
+ return nil
146
+ }
147
+
148
+ func clearAcl(cli *cli.Context) error {
149
+ _, db, err := configAndStorage(cli)
150
+ if err != nil {
151
+ return err
152
+ }
153
+ policy, err := resolvePolicy(cli)
154
+ if err != nil {
155
+ return err
156
+ }
157
+ err = db.ClearPolicy(context.Background(), policy)
158
+ if err != nil {
159
+ return err
160
+ }
161
+ return nil
162
+ }
163
+
164
+ func describe(cli *cli.Context) error {
165
+ showHeader := !cli.Bool(noHeaderFlag.Name)
166
+ if cli.IsSet(policyFlag.Name) {
167
+ return describePolicy(cli, showHeader)
168
+ }
169
+ return describePolicies(cli, showHeader)
170
+ }
171
+
172
+ func describePolicy(cli *cli.Context, showHeader bool) error {
173
+ _, db, err := configAndStorage(cli)
174
+ if err != nil {
175
+ return err
176
+ }
177
+
178
+ policyName, err := resolvePolicy(cli)
179
+ if err != nil {
180
+ return err
181
+ }
182
+
183
+ if showHeader {
184
+ policy, err := db.DescribePolicy(context.Background(), policyName)
185
+ if err != nil {
186
+ return err
187
+ }
188
+ fmt.Printf("%s: %s\n", "Policy", policy.Name)
189
+ fmt.Printf("%s: %s\n", "Action", policy.Desc())
190
+ }
191
+ query, err := resolveAddresses(cli, false)
192
+ if err != nil {
193
+ return nil
194
+ }
195
+ list, err := db.ListAcl(context.Background(), policyName, query)
196
+ if err != nil {
197
+ return err
198
+ }
199
+
200
+ if showHeader {
201
+ fmt.Println("Addresses:")
202
+ }
203
+ for _, address := range list {
204
+ fmt.Println(address.Hex())
205
+ }
206
+ return nil
207
+ }
208
+
209
+ func describePolicies(cli *cli.Context, showHeader bool) error {
210
+ _, db, err := configAndStorage(cli)
211
+ if err != nil {
212
+ return err
213
+ }
214
+ list, err := db.DescribePolicies(context.Background())
215
+ if err != nil {
216
+ return err
217
+ }
218
+
219
+ if showHeader {
220
+ fmt.Printf("%7s: %s\n", "Policy", "Action")
221
+ }
222
+ for _, p := range list {
223
+ fmt.Printf("%7s: %s\n", p.Name, p.Desc())
224
+ }
225
+
226
+ return nil
227
+ }
228
+
229
+ func configAndStorage(cli *cli.Context) (*config.Config, *pgpoolstorage.PostgresPoolStorage, error) {
230
+ c, err := config.Load(cli, false)
231
+ if err != nil {
232
+ return nil, nil, err
233
+ }
234
+ setupLog(c.Log)
235
+
236
+ db, err := pgpoolstorage.NewPostgresPoolStorage(c.Pool.DB)
237
+ if err != nil {
238
+ return nil, nil, err
239
+ }
240
+ return c, db, nil
241
+ }
242
+
243
+ func requirePolicyAndAddresses(cli *cli.Context) (pool.PolicyName, []common.Address, error) {
244
+ policy, err := resolvePolicy(cli)
245
+ if err != nil {
246
+ return "", nil, err
247
+ }
248
+ addresses, err := resolveAddresses(cli, true)
249
+ if err != nil {
250
+ return "", nil, err
251
+ }
252
+ return policy, addresses, nil
253
+ }
254
+
255
+ func resolvePolicy(cli *cli.Context) (pool.PolicyName, error) {
256
+ policy := cli.String(policyFlag.Name)
257
+ if policy == "" {
258
+ return "", nil
259
+ }
260
+ if !pool.IsPolicy(policy) {
261
+ return "", fmt.Errorf("invalid policy name: %s", policy)
262
+ }
263
+ return pool.PolicyName(policy), nil
264
+ }
265
+
266
+ func resolveAddresses(cli *cli.Context, failIfEmpty bool) ([]common.Address, error) {
267
+ var set = make(map[common.Address]struct{})
268
+ if cli.IsSet("csv") {
269
+ file := cli.String(csvFlag.Name)
270
+ fd, err := os.Open(file)
271
+ if err != nil {
272
+ return nil, err
273
+ }
274
+ defer func(fd *os.File) {
275
+ _ = fd.Close()
276
+ }(fd)
277
+
278
+ fileReader := csv.NewReader(fd)
279
+ records, err := fileReader.ReadAll()
280
+
281
+ if err != nil {
282
+ return nil, err
283
+ }
284
+ for _, row := range records {
285
+ for _, cell := range row {
286
+ hex := strings.TrimSpace(cell)
287
+ set[common.HexToAddress(hex)] = struct{}{}
288
+ }
289
+ }
290
+ }
291
+
292
+ for _, a := range cli.Args().Slice() {
293
+ a = strings.TrimSpace(a)
294
+ a = strings.Trim(a, ",|")
295
+ if !strings.HasPrefix(a, "0x") {
296
+ a = "0x" + a
297
+ }
298
+ set[common.HexToAddress(a)] = struct{}{}
299
+ }
300
+ var ret []common.Address
301
+ for a := range set {
302
+ ret = append(ret, a)
303
+ }
304
+ if failIfEmpty && len(ret) == 0 {
305
+ return nil, errors.New("no addresses given")
306
+ }
307
+ return ret, nil
308
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/run.go RENAMED
@@ -2,6 +2,7 @@
2
 
3
  import (
4
  "context"
 
5
  "errors"
6
  "fmt"
7
  "net"
@@ -108,19 +113,27 @@
108
  log.Fatal(err)
109
  }
110
 
111
- etherman, err := newEtherman(*c)
 
112
  if err != nil {
113
  log.Fatal(err)
114
  }
115
-
116
- // READ CHAIN ID FROM POE SC
117
- l2ChainID, err := etherman.GetL2ChainID()
118
  if err != nil {
119
  log.Fatal(err)
120
  }
121
 
 
 
 
 
122
  st, currentForkID := newState(cliCtx.Context, c, etherman, l2ChainID, stateSqlDB, eventLog, needsExecutor, needsStateTree, false)
123
 
 
 
 
 
 
124
  c.Aggregator.ChainID = l2ChainID
125
  c.Sequencer.StreamServer.ChainID = l2ChainID
126
  log.Infof("Chain ID read from POE SC = %v", l2ChainID)
@@ -277,8 +290,86 @@
277
  }
278
  }
279
 
280
- func newEtherman(c config.Config) (*etherman.Client, error) {
281
- return etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
282
  }
283
 
284
  func newL2EthClient(url string) (*ethclient.Client, error) {
@@ -321,7 +412,7 @@
321
  // If synchronizer are using sequential mode, we only need one etherman client
322
  if cfg.Synchronizer.L1SynchronizationMode == synchronizer.ParallelMode {
323
  for i := 0; i < int(cfg.Synchronizer.L1ParallelSynchronization.MaxClients+1); i++ {
324
- eth, err := newEtherman(cfg)
325
  if err != nil {
326
  log.Fatal(err)
327
  }
@@ -426,12 +517,12 @@
426
  }
427
 
428
  func createSequenceSender(cfg config.Config, pool *pool.Pool, etmStorage *ethtxmanager.PostgresStorage, st *state.State, eventLog *event.EventLog) *sequencesender.SequenceSender {
429
- etherman, err := newEtherman(cfg)
430
  if err != nil {
431
  log.Fatal(err)
432
  }
433
 
434
- auth, err := etherman.LoadAuthFromKeyStore(cfg.SequenceSender.PrivateKey.Path, cfg.SequenceSender.PrivateKey.Password)
435
  if err != nil {
436
  log.Fatal(err)
437
  }
@@ -441,7 +532,12 @@
441
 
442
  ethTxManager := ethtxmanager.New(cfg.EthTxManager, etherman, etmStorage, st)
443
 
444
- seqSender, err := sequencesender.New(cfg.SequenceSender, st, etherman, ethTxManager, eventLog)
 
 
 
 
 
445
  if err != nil {
446
  log.Fatal(err)
447
  }
@@ -450,7 +546,23 @@
450
  }
451
 
452
  func runAggregator(ctx context.Context, c aggregator.Config, etherman *etherman.Client, ethTxManager *ethtxmanager.Client, st *state.State) {
453
- agg, err := aggregator.New(c, st, ethTxManager, etherman)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
454
  if err != nil {
455
  log.Fatal(err)
456
  }
@@ -520,14 +632,14 @@
520
  }
521
  log.Infof("Starting L1InfoRoot: %v", l1inforoot.String())
522
 
523
- forkIDIntervals, err := forkIDIntervals(ctx, st, etherman, c.NetworkConfig.Genesis.BlockNumber)
524
  if err != nil {
525
  log.Fatal("error getting forkIDs. Error: ", err)
526
  }
527
  st.UpdateForkIDIntervalsInMemory(forkIDIntervals)
528
 
529
  currentForkID := forkIDIntervals[len(forkIDIntervals)-1].ForkId
530
- log.Infof("Fork ID read from POE SC = %v", forkIDIntervals[len(forkIDIntervals)-1].ForkId)
531
 
532
  return st, currentForkID
533
  }
@@ -543,13 +655,13 @@
543
  }
544
 
545
  func createEthTxManager(cfg config.Config, etmStorage *ethtxmanager.PostgresStorage, st *state.State) *ethtxmanager.Client {
546
- etherman, err := newEtherman(cfg)
547
  if err != nil {
548
  log.Fatal(err)
549
  }
550
 
551
  for _, privateKey := range cfg.EthTxManager.PrivateKeys {
552
- _, err := etherman.LoadAuthFromKeyStore(privateKey.Path, privateKey.Password)
553
  if err != nil {
554
  log.Fatal(err)
555
  }
@@ -681,14 +793,32 @@
681
  }
682
  forkIDIntervals = forkIntervals
683
  } else {
684
- log.Debug("Getting initial forkID")
685
- forkIntervals, err := etherman.GetForks(ctx, genesisBlockNumber, genesisBlockNumber)
 
 
 
 
 
 
 
 
686
  if err != nil {
687
  return []state.ForkIDInterval{}, fmt.Errorf("error getting forks. Please check the configuration. Error: %v", err)
688
  } else if len(forkIntervals) == 0 {
689
  return []state.ForkIDInterval{}, fmt.Errorf("error: no forkID received. It should receive at least one, please check the configuration...")
690
  }
691
  forkIDIntervals = forkIntervals
 
 
 
 
 
 
 
 
 
 
692
  }
693
  }
694
  return forkIDIntervals, nil
 
2
 
3
  import (
4
  "context"
5
+ "crypto/ecdsa"
6
  "errors"
7
  "fmt"
8
  "net"
 
113
  log.Fatal(err)
114
  }
115
 
116
+ // READ CHAIN ID FROM POE SC
117
+ tmpEthMan, err := etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config, nil, nil)
118
  if err != nil {
119
  log.Fatal(err)
120
  }
121
+ l2ChainID, err := tmpEthMan.GetL2ChainID()
 
 
122
  if err != nil {
123
  log.Fatal(err)
124
  }
125
 
126
+ etherman, err := etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config, nil, nil)
127
+ if err != nil {
128
+ log.Fatal(err)
129
+ }
130
  st, currentForkID := newState(cliCtx.Context, c, etherman, l2ChainID, stateSqlDB, eventLog, needsExecutor, needsStateTree, false)
131
 
132
+ etherman, err = newEtherman(*c, st)
133
+ if err != nil {
134
+ log.Fatal(err)
135
+ }
136
+
137
  c.Aggregator.ChainID = l2ChainID
138
  c.Sequencer.StreamServer.ChainID = l2ChainID
139
  log.Infof("Chain ID read from POE SC = %v", l2ChainID)
 
290
  }
291
  }
292
 
293
+ func newEtherman(c config.Config, st *state.State) (*etherman.Client, error) {
294
+ ethman, err := etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config, nil, nil)
295
+ if err != nil {
296
+ return nil, err
297
+ }
298
+ da, err := newDataAvailability(c, st, ethman, false)
299
+ if err != nil {
300
+ return nil, err
301
+ }
302
+ return etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config, da, st)
303
+ }
304
+
305
+ func newDataAvailability(c config.Config, st *state.State, etherman *etherman.Client, isSequenceSender bool) (*dataavailability.DataAvailability, error) {
306
+ var (
307
+ trustedSequencerURL string
308
+ dataSourcePriority []dataavailability.DataSourcePriority
309
+ err error
310
+ )
311
+ if !c.IsTrustedSequencer {
312
+ if c.Synchronizer.TrustedSequencerURL != "" {
313
+ trustedSequencerURL = c.Synchronizer.TrustedSequencerURL
314
+ } else {
315
+ log.Debug("getting trusted sequencer URL from smc")
316
+ trustedSequencerURL, err = etherman.GetTrustedSequencerURL()
317
+ if err != nil {
318
+ return nil, fmt.Errorf("error getting trusted sequencer URI. Error: %v", err)
319
+ }
320
+ }
321
+ log.Debug("trustedSequencerURL ", trustedSequencerURL)
322
+ }
323
+ zkEVMClient := client.NewClient(trustedSequencerURL)
324
+
325
+ dataSourcePriority = c.Synchronizer.L2Synchronization.DataSourcePriority
326
+ if len(dataSourcePriority) == 0 {
327
+ dataSourcePriority = dataavailability.DefaultPriority
328
+ }
329
+
330
+ // Backend specific config
331
+ daProtocolName, err := etherman.GetDAProtocolName()
332
+ if err != nil {
333
+ return nil, fmt.Errorf("error getting data availability protocol name: %v", err)
334
+ }
335
+ var daBackend dataavailability.DABackender
336
+ switch daProtocolName {
337
+ case string(dataavailability.DataAvailabilityCommittee):
338
+ var (
339
+ pk *ecdsa.PrivateKey
340
+ err error
341
+ )
342
+ if isSequenceSender {
343
+ _, pk, err = etherman.LoadAuthFromKeyStore(c.SequenceSender.PrivateKey.Path, c.SequenceSender.PrivateKey.Password)
344
+ if err != nil {
345
+ return nil, err
346
+ }
347
+ }
348
+ dacAddr, err := etherman.GetDAProtocolAddr()
349
+ if err != nil {
350
+ return nil, fmt.Errorf("error getting trusted sequencer URI. Error: %v", err)
351
+ }
352
+
353
+ daBackend, err = datacommittee.New(
354
+ c.Etherman.URL,
355
+ dacAddr,
356
+ pk,
357
+ dataCommitteeClient.NewFactory(),
358
+ )
359
+ if err != nil {
360
+ return nil, err
361
+ }
362
+ default:
363
+ return nil, fmt.Errorf("unexpected / unsupported DA protocol: %s", daProtocolName)
364
+ }
365
+
366
+ return dataavailability.New(
367
+ c.IsTrustedSequencer,
368
+ daBackend,
369
+ st,
370
+ zkEVMClient,
371
+ dataSourcePriority,
372
+ )
373
  }
374
 
375
  func newL2EthClient(url string) (*ethclient.Client, error) {
 
412
  // If synchronizer are using sequential mode, we only need one etherman client
413
  if cfg.Synchronizer.L1SynchronizationMode == synchronizer.ParallelMode {
414
  for i := 0; i < int(cfg.Synchronizer.L1ParallelSynchronization.MaxClients+1); i++ {
415
+ eth, err := newEtherman(cfg, st)
416
  if err != nil {
417
  log.Fatal(err)
418
  }
 
517
  }
518
 
519
  func createSequenceSender(cfg config.Config, pool *pool.Pool, etmStorage *ethtxmanager.PostgresStorage, st *state.State, eventLog *event.EventLog) *sequencesender.SequenceSender {
520
+ etherman, err := newEtherman(cfg, st)
521
  if err != nil {
522
  log.Fatal(err)
523
  }
524
 
525
+ auth, _, err := etherman.LoadAuthFromKeyStore(cfg.SequenceSender.PrivateKey.Path, cfg.SequenceSender.PrivateKey.Password)
526
  if err != nil {
527
  log.Fatal(err)
528
  }
 
532
 
533
  ethTxManager := ethtxmanager.New(cfg.EthTxManager, etherman, etmStorage, st)
534
 
535
+ da, err := newDataAvailability(cfg, st, etherman, true)
536
+ if err != nil {
537
+ log.Fatal(err)
538
+ }
539
+
540
+ seqSender, err := sequencesender.New(cfg.SequenceSender, st, etherman, ethTxManager, eventLog, da)
541
  if err != nil {
542
  log.Fatal(err)
543
  }
 
546
  }
547
 
548
  func runAggregator(ctx context.Context, c aggregator.Config, etherman *etherman.Client, ethTxManager *ethtxmanager.Client, st *state.State) {
549
+ var (
550
+ aggCli *agglayerClient.Client
551
+ pk *ecdsa.PrivateKey
552
+ err error
553
+ )
554
+
555
+ if c.SettlementBackend == aggregator.AggLayer {
556
+ aggCli = agglayerClient.New(c.AggLayerURL)
557
+
558
+ // Load private key
559
+ pk, err = config.NewKeyFromKeystore(c.SequencerPrivateKey)
560
+ if err != nil {
561
+ log.Fatal(err)
562
+ }
563
+ }
564
+
565
+ agg, err := aggregator.New(c, st, ethTxManager, etherman, aggCli, pk)
566
  if err != nil {
567
  log.Fatal(err)
568
  }
 
632
  }
633
  log.Infof("Starting L1InfoRoot: %v", l1inforoot.String())
634
 
635
+ forkIDIntervals, err := forkIDIntervals(ctx, st, etherman, c.NetworkConfig.Genesis.RollupBlockNumber)
636
  if err != nil {
637
  log.Fatal("error getting forkIDs. Error: ", err)
638
  }
639
  st.UpdateForkIDIntervalsInMemory(forkIDIntervals)
640
 
641
  currentForkID := forkIDIntervals[len(forkIDIntervals)-1].ForkId
642
+ log.Infof("Fork ID read from POE SC = %v", currentForkID)
643
 
644
  return st, currentForkID
645
  }
 
655
  }
656
 
657
  func createEthTxManager(cfg config.Config, etmStorage *ethtxmanager.PostgresStorage, st *state.State) *ethtxmanager.Client {
658
+ etherman, err := newEtherman(cfg, st)
659
  if err != nil {
660
  log.Fatal(err)
661
  }
662
 
663
  for _, privateKey := range cfg.EthTxManager.PrivateKeys {
664
+ _, _, err := etherman.LoadAuthFromKeyStore(privateKey.Path, privateKey.Password)
665
  if err != nil {
666
  log.Fatal(err)
667
  }
 
793
  }
794
  forkIDIntervals = forkIntervals
795
  } else {
796
+ log.Debug("Getting all forkIDs")
797
+
798
+ // Get last L1 block number
799
+ bn, err := etherman.GetLatestBlockNumber(ctx)
800
+ if err != nil {
801
+ return []state.ForkIDInterval{}, fmt.Errorf("error getting latest block number. Error: %v", err)
802
+ }
803
+
804
+ // Get all forkIDs since genesis
805
+ forkIntervals, err := etherman.GetForks(ctx, genesisBlockNumber, bn)
806
  if err != nil {
807
  return []state.ForkIDInterval{}, fmt.Errorf("error getting forks. Please check the configuration. Error: %v", err)
808
  } else if len(forkIntervals) == 0 {
809
  return []state.ForkIDInterval{}, fmt.Errorf("error: no forkID received. It should receive at least one, please check the configuration...")
810
  }
811
  forkIDIntervals = forkIntervals
812
+
813
+ log.Debugf("Retrieved %d forkIDs", len(forkIDIntervals))
814
+
815
+ log.Debug("Adding forkIDs to db and memory")
816
+ for _, forkID := range forkIDIntervals {
817
+ err = st.AddForkIDInterval(ctx, forkID, nil)
818
+ if err != nil {
819
+ log.Fatal("error adding forkID to db. Error: ", err)
820
+ }
821
+ }
822
  }
823
  }
824
  return forkIDIntervals, nil
{/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/set_data_availability_protocol.go RENAMED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package main
2
+
3
+ import (
4
+ "github.com/0xPolygonHermez/zkevm-node/config"
5
+ "github.com/0xPolygonHermez/zkevm-node/log"
6
+ "github.com/ethereum/go-ethereum/common"
7
+ "github.com/urfave/cli/v2"
8
+ )
9
+
10
+ const flagDAAddress = "data-availability-address"
11
+
12
+ var setDataAvailabilityProtocolFlags = []cli.Flag{
13
+ &cli.StringFlag{
14
+ Name: flagDAAddress,
15
+ Aliases: []string{"da-addr"},
16
+ Usage: "address of the new data availibility protocol",
17
+ Required: true,
18
+ },
19
+ &cli.StringFlag{
20
+ Name: config.FlagKeyStorePath,
21
+ Aliases: []string{"ksp"},
22
+ Usage: "the path of the key store file containing the private key of the account going to set new data availability protocol",
23
+ Required: true,
24
+ },
25
+ &cli.StringFlag{
26
+ Name: config.FlagPassword,
27
+ Aliases: []string{"pw"},
28
+ Usage: "the password do decrypt the key store file",
29
+ Required: true,
30
+ },
31
+ &configFileFlag,
32
+ &networkFlag,
33
+ &customNetworkFlag,
34
+ }
35
+
36
+ func setDataAvailabilityProtocol(ctx *cli.Context) error {
37
+ c, err := config.Load(ctx, true)
38
+ if err != nil {
39
+ return err
40
+ }
41
+
42
+ setupLog(c.Log)
43
+
44
+ daAddress := common.HexToAddress(ctx.String(flagDAAddress))
45
+ addrKeyStorePath := ctx.String(config.FlagKeyStorePath)
46
+ addrPassword := ctx.String(config.FlagPassword)
47
+
48
+ etherman, err := newEtherman(*c, nil)
49
+ if err != nil {
50
+ log.Fatal(err)
51
+ return err
52
+ }
53
+
54
+ auth, _, err := etherman.LoadAuthFromKeyStore(addrKeyStorePath, addrPassword)
55
+ if err != nil {
56
+ log.Fatal(err)
57
+ return err
58
+ }
59
+
60
+ tx, err := etherman.SetDataAvailabilityProtocol(auth.From, daAddress)
61
+ if err != nil {
62
+ return err
63
+ }
64
+
65
+ log.Infof("Transaction to set new data availability protocol sent. Hash: %s", tx.Hash())
66
+
67
+ return nil
68
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/config/cardonagenesis.go RENAMED
@@ -1,109 +0,0 @@
1
- package config
2
-
3
- // CardonaNetworkConfigJSON is the hardcoded network configuration to be used for the official mainnet setup
4
- const CardonaNetworkConfigJSON = `
5
- {
6
- "l1Config": {
7
- "polygonZkEVMAddress": "0xA13Ddb14437A8F34897131367ad3ca78416d6bCa",
8
- "polygonZkEVMBridgeAddress": "0x528e26b25a34a4A5d0dbDa1d57D318153d2ED582",
9
- "polygonZkEVMGlobalExitRootAddress": "0xAd1490c248c5d3CbAE399Fd529b79B42984277DF",
10
- "polTokenAddress": "0x6a7c3F4B0651d6DA389AD1d11D962ea458cDCA70",
11
- "polygonRollupManagerAddress": "0x32d33D5137a7cFFb54c5Bf8371172bcEc5f310ff",
12
- "chainId": 11155111
13
- },
14
- "genesisBlockNumber": 4789190,
15
- "root": "0x91dfcdeb628dfdc51f3a2ee38cb17c78581e4e7ff91bcc2e327d24a9dfa46982",
16
- "genesis": [
17
- {
18
- "contractName": "PolygonZkEVMDeployer",
19
- "balance": "0",
20
- "nonce": "4",
21
- "address": "0x36810012486fc134D0679c07f85fe5ba5A087D8C",
22
- "bytecode": "0x6080604052600436106100705760003560e01c8063715018a61161004e578063715018a6146100e65780638da5cb5b146100fb578063e11ae6cb14610126578063f2fde38b1461013957600080fd5b80632b79805a146100755780634a94d4871461008a5780636d07dbf81461009d575b600080fd5b610088610083366004610927565b610159565b005b6100886100983660046109c7565b6101cb565b3480156100a957600080fd5b506100bd6100b8366004610a1e565b61020d565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b50610088610220565b34801561010757600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100bd565b610088610134366004610a40565b610234565b34801561014557600080fd5b50610088610154366004610a90565b61029b565b610161610357565b600061016e8585856103d8565b905061017a8183610537565b5060405173ffffffffffffffffffffffffffffffffffffffff821681527fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a15050505050565b6101d3610357565b6101de83838361057b565b506040517f25adb19089b6a549831a273acdf7908cff8b7ee5f551f8d1d37996cf01c5df5b90600090a1505050565b600061021983836105a9565b9392505050565b610228610357565b61023260006105b6565b565b61023c610357565b60006102498484846103d8565b60405173ffffffffffffffffffffffffffffffffffffffff821681529091507fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a150505050565b6102a3610357565b73ffffffffffffffffffffffffffffffffffffffff811661034b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610354816105b6565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610232576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610342565b600083471015610444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e63650000006044820152606401610342565b81516000036104af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152606401610342565b8282516020840186f5905073ffffffffffffffffffffffffffffffffffffffff8116610219576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152606401610342565b6060610219838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c6564000081525061062b565b60606105a1848484604051806060016040528060298152602001610b3d6029913961062b565b949350505050565b6000610219838330610744565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060824710156106bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610342565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516106e69190610acf565b60006040518083038185875af1925050503d8060008114610723576040519150601f19603f3d011682016040523d82523d6000602084013e610728565b606091505b50915091506107398783838761076e565b979650505050505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b606083156108045782516000036107fd5773ffffffffffffffffffffffffffffffffffffffff85163b6107fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610342565b50816105a1565b6105a183838151156108195781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103429190610aeb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261088d57600080fd5b813567ffffffffffffffff808211156108a8576108a861084d565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156108ee576108ee61084d565b8160405283815286602085880101111561090757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806080858703121561093d57600080fd5b8435935060208501359250604085013567ffffffffffffffff8082111561096357600080fd5b61096f8883890161087c565b9350606087013591508082111561098557600080fd5b506109928782880161087c565b91505092959194509250565b803573ffffffffffffffffffffffffffffffffffffffff811681146109c257600080fd5b919050565b6000806000606084860312156109dc57600080fd5b6109e58461099e565b9250602084013567ffffffffffffffff811115610a0157600080fd5b610a0d8682870161087c565b925050604084013590509250925092565b60008060408385031215610a3157600080fd5b50508035926020909101359150565b600080600060608486031215610a5557600080fd5b8335925060208401359150604084013567ffffffffffffffff811115610a7a57600080fd5b610a868682870161087c565b9150509250925092565b600060208284031215610aa257600080fd5b6102198261099e565b60005b83811015610ac6578181015183820152602001610aae565b50506000910152565b60008251610ae1818460208701610aab565b9190910192915050565b6020815260008251806020840152610b0a816040850160208701610aab565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a26469706673582212203e70ce334e8ec9d8d03e87415afd36dce4e82633bd277b08937095a6bd66367764736f6c63430008110033",
23
- "storage": {
24
- "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000ff6250d0e86a2465b0c1bf8e36409503d6a26963"
25
- }
26
- },
27
- {
28
- "contractName": "ProxyAdmin",
29
- "balance": "0",
30
- "nonce": "1",
31
- "address": "0x85cEB41028B1a5ED2b88E395145344837308b251",
32
- "bytecode": "0x60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461012b57806399a88ec41461013e578063f2fde38b1461015e578063f3b7dead1461017e57600080fd5b8063204e1c7a14610080578063715018a6146100c95780637eff275e146100e05780638da5cb5b14610100575b600080fd5b34801561008c57600080fd5b506100a061009b366004610608565b61019e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100d557600080fd5b506100de610255565b005b3480156100ec57600080fd5b506100de6100fb36600461062c565b610269565b34801561010c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100a0565b6100de610139366004610694565b6102f7565b34801561014a57600080fd5b506100de61015936600461062c565b61038c565b34801561016a57600080fd5b506100de610179366004610608565b6103e8565b34801561018a57600080fd5b506100a0610199366004610608565b6104a4565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907f5c60da1b00000000000000000000000000000000000000000000000000000000815260040190565b600060405180830381855afa9150503d8060008114610225576040519150601f19603f3d011682016040523d82523d6000602084013e61022a565b606091505b50915091508161023957600080fd5b8080602001905181019061024d9190610788565b949350505050565b61025d6104f0565b6102676000610571565b565b6102716104f0565b6040517f8f28397000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690638f283970906024015b600060405180830381600087803b1580156102db57600080fd5b505af11580156102ef573d6000803e3d6000fd5b505050505050565b6102ff6104f0565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef28690349061035590869086906004016107a5565b6000604051808303818588803b15801561036e57600080fd5b505af1158015610382573d6000803e3d6000fd5b5050505050505050565b6103946104f0565b6040517f3659cfe600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690633659cfe6906024016102c1565b6103f06104f0565b73ffffffffffffffffffffffffffffffffffffffff8116610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6104a181610571565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907ff851a44000000000000000000000000000000000000000000000000000000000815260040190565b60005473ffffffffffffffffffffffffffffffffffffffff163314610267576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161048f565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff811681146104a157600080fd5b60006020828403121561061a57600080fd5b8135610625816105e6565b9392505050565b6000806040838503121561063f57600080fd5b823561064a816105e6565b9150602083013561065a816105e6565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156106a957600080fd5b83356106b4816105e6565b925060208401356106c4816105e6565b9150604084013567ffffffffffffffff808211156106e157600080fd5b818601915086601f8301126106f557600080fd5b81358181111561070757610707610665565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561074d5761074d610665565b8160405282815289602084870101111561076657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60006020828403121561079a57600080fd5b8151610625816105e6565b73ffffffffffffffffffffffffffffffffffffffff8316815260006020604081840152835180604085015260005b818110156107ef578581018301518582016060015282016107d3565b5060006060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010192505050939250505056fea2646970667358221220372a0e10eebea1b7fa43ae4c976994e6ed01d85eedc3637b83f01d3f06be442064736f6c63430008110033",
33
- "storage": {
34
- "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000dbc6981a11fc2b000c635bfa7c47676b25c87d39"
35
- }
36
- },
37
- {
38
- "contractName": "PolygonZkEVMBridge implementation",
39
- "balance": "0",
40
- "nonce": "1",
41
- "address": "0x8BD36ca1A55e389335004872aA3C3Be0969D3aA7",
42
- "bytecode": "0x6080604052600436106200019f5760003560e01c8063647c576c11620000e7578063be5831c71162000089578063dbc169761162000060578063dbc169761462000639578063ee25560b1462000651578063fb570834146200068257600080fd5b8063be5831c714620005ae578063cd58657914620005ea578063d02103ca146200060157600080fd5b80639e34070f11620000be5780639e34070f146200050a578063aaa13cc2146200054f578063bab161bf146200057457600080fd5b8063647c576c146200048657806379e2cf9714620004ab57806381b1c17414620004c357600080fd5b80632d2c9d94116200015157806334ac9cf2116200012857806334ac9cf2146200034b5780633ae05047146200037a5780633e197043146200039257600080fd5b80632d2c9d9414620002765780632dfdf0b5146200029b578063318aee3d14620002c257600080fd5b806322e95f2c116200018657806322e95f2c14620001ef578063240ff378146200023a5780632cffd02e146200025157600080fd5b806315064c9614620001a45780632072f6c514620001d5575b600080fd5b348015620001b157600080fd5b50606854620001c09060ff1681565b60405190151581526020015b60405180910390f35b348015620001e257600080fd5b50620001ed620006a7565b005b348015620001fc57600080fd5b50620002146200020e366004620032db565b62000705565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001620001cc565b620001ed6200024b36600462003372565b620007a8565b3480156200025e57600080fd5b50620001ed6200027036600462003409565b620009d0565b3480156200028357600080fd5b50620001ed6200029536600462003409565b62000f74565b348015620002a857600080fd5b50620002b360535481565b604051908152602001620001cc565b348015620002cf57600080fd5b5062000319620002e1366004620034ef565b606b6020526000908152604090205463ffffffff811690640100000000900473ffffffffffffffffffffffffffffffffffffffff1682565b6040805163ffffffff909316835273ffffffffffffffffffffffffffffffffffffffff909116602083015201620001cc565b3480156200035857600080fd5b50606c54620002149073ffffffffffffffffffffffffffffffffffffffff1681565b3480156200038757600080fd5b50620002b362001178565b3480156200039f57600080fd5b50620002b3620003b136600462003526565b6040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b3480156200049357600080fd5b50620001ed620004a5366004620035b0565b6200125e565b348015620004b857600080fd5b50620001ed620014ad565b348015620004d057600080fd5b5062000214620004e236600462003600565b606a6020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200051757600080fd5b50620001c06200052936600462003600565b600881901c600090815260696020526040902054600160ff9092169190911b9081161490565b3480156200055c57600080fd5b50620002146200056e3660046200361a565b620014e7565b3480156200058157600080fd5b506068546200059890610100900463ffffffff1681565b60405163ffffffff9091168152602001620001cc565b348015620005bb57600080fd5b506068546200059890790100000000000000000000000000000000000000000000000000900463ffffffff1681565b620001ed620005fb366004620036ce565b620016d3565b3480156200060e57600080fd5b50606854620002149065010000000000900473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200064657600080fd5b50620001ed62001c37565b3480156200065e57600080fd5b50620002b36200067036600462003600565b60696020526000908152604090205481565b3480156200068f57600080fd5b50620001c0620006a136600462003770565b62001c93565b606c5473ffffffffffffffffffffffffffffffffffffffff163314620006f9576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362001d7c565b565b6040805160e084901b7fffffffff0000000000000000000000000000000000000000000000000000000016602080830191909152606084901b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602483015282516018818403018152603890920183528151918101919091206000908152606a909152205473ffffffffffffffffffffffffffffffffffffffff165b92915050565b60685460ff1615620007e6576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff8681166101009092041614806200080c5750600263ffffffff861610155b1562000844576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b6001606860019054906101000a900463ffffffff163388883488886053546040516200089a9998979695949392919062003806565b60405180910390a1620009b8620009b26001606860019054906101000a900463ffffffff16338989348989604051620008d592919062003881565b60405180910390206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b62001e10565b8215620009c957620009c962001f27565b5050505050565b60685460ff161562000a0e576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000a258b8b8b8b8b8b8b8b8b8b8b600062001ffc565b73ffffffffffffffffffffffffffffffffffffffff861662000b01576040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff861690859060405162000a7a9190620038e6565b60006040518083038185875af1925050503d806000811462000ab9576040519150601f19603f3d011682016040523d82523d6000602084013e62000abe565b606091505b505090508062000afa576040517f6747a28800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5062000efc565b60685463ffffffff61010090910481169088160362000b435762000b3d73ffffffffffffffffffffffffffffffffffffffff87168585620021ed565b62000efc565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b166024820152600090603801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000818152606a90935291205490915073ffffffffffffffffffffffffffffffffffffffff168062000e6e576000808062000c1886880188620039fb565b92509250925060008584848460405162000c329062003292565b62000c409392919062003abd565b8190604051809103906000f590508015801562000c61573d6000803e3d6000fd5b506040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c81166004830152602482018c9052919250908216906340c10f1990604401600060405180830381600087803b15801562000cd757600080fd5b505af115801562000cec573d6000803e3d6000fd5b5050505080606a600088815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060405180604001604052808e63ffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff16815250606b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050507f490e59a1701b938786ac72570a1efeac994a3dbe96e2e883e19e902ace6e6a398d8d838b8b60405162000e5c95949392919062003afa565b60405180910390a15050505062000ef9565b6040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018790528216906340c10f1990604401600060405180830381600087803b15801562000edf57600080fd5b505af115801562000ef4573d6000803e3d6000fd5b505050505b50505b6040805163ffffffff8c811682528916602082015273ffffffffffffffffffffffffffffffffffffffff88811682840152861660608201526080810185905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a15050505050505050505050565b60685460ff161562000fb2576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000fc98b8b8b8b8b8b8b8b8b8b8b600162001ffc565b60008473ffffffffffffffffffffffffffffffffffffffff1684888a868660405160240162000ffc949392919062003b42565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1806b5f200000000000000000000000000000000000000000000000000000000179052516200107f9190620038e6565b60006040518083038185875af1925050503d8060008114620010be576040519150601f19603f3d011682016040523d82523d6000602084013e620010c3565b606091505b5050905080620010ff576040517f37e391c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805163ffffffff8d811682528a16602082015273ffffffffffffffffffffffffffffffffffffffff89811682840152871660608201526080810186905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a1505050505050505050505050565b605354600090819081805b602081101562001255578083901c600116600103620011e65760338160208110620011b257620011b262003b8a565b0154604080516020810192909252810185905260600160405160208183030381529060405280519060200120935062001213565b60408051602081018690529081018390526060016040516020818303038152906040528051906020012093505b604080516020810184905290810183905260600160405160208183030381529060405280519060200120915080806200124c9062003be8565b91505062001183565b50919392505050565b600054610100900460ff16158080156200127f5750600054600160ff909116105b806200129b5750303b1580156200129b575060005460ff166001145b6200132d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156200138c57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b606880547fffffffffffffff000000000000000000000000000000000000000000000000ff1661010063ffffffff8716027fffffffffffffff0000000000000000000000000000000000000000ffffffffff16176501000000000073ffffffffffffffffffffffffffffffffffffffff8681169190910291909117909155606c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001691841691909117905562001443620022c3565b8015620014a757600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b605354606854790100000000000000000000000000000000000000000000000000900463ffffffff16101562000703576200070362001f27565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b1660248201526000908190603801604051602081830303815290604052805190602001209050600060ff60f81b3083604051806020016200157d9062003292565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082820381018352601f909101166040819052620015c8908d908d908d908d908d9060200162003c23565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905262001606929160200162003c64565b604051602081830303815290604052805190602001206040516020016200168f94939291907fff0000000000000000000000000000000000000000000000000000000000000094909416845260609290921b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660018401526015830152603582015260550190565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815291905280516020909101209a9950505050505050505050565b60685460ff161562001711576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200171b62002366565b60685463ffffffff888116610100909204161480620017415750600263ffffffff881610155b1562001779576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060608773ffffffffffffffffffffffffffffffffffffffff8816620017df57883414620017d5576040517fb89240f500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000925062001ad9565b341562001818576040517f798ee6f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8089166000908152606b602090815260409182902082518084019093525463ffffffff811683526401000000009004909216918101829052901562001908576040517f9dc29fac000000000000000000000000000000000000000000000000000000008152336004820152602481018b905273ffffffffffffffffffffffffffffffffffffffff8a1690639dc29fac90604401600060405180830381600087803b158015620018db57600080fd5b505af1158015620018f0573d6000803e3d6000fd5b50505050806020015194508060000151935062001ad7565b85156200191d576200191d898b8989620023db565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8b16906370a0823190602401602060405180830381865afa1580156200198b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620019b1919062003c97565b9050620019d773ffffffffffffffffffffffffffffffffffffffff8b1633308e620028f9565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa15801562001a45573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001a6b919062003c97565b905062001a79828262003cb1565b6068548c9850610100900463ffffffff169650935062001a998762002959565b62001aa48c62002a71565b62001aaf8d62002b7e565b60405160200162001ac39392919062003abd565b604051602081830303815290604052945050505b505b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b600084868e8e868860535460405162001b1b98979695949392919062003cc7565b60405180910390a162001c0f620009b2600085878f8f8789805190602001206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b861562001c205762001c2062001f27565b5050505062001c2e60018055565b50505050505050565b606c5473ffffffffffffffffffffffffffffffffffffffff16331462001c89576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362002c80565b600084815b602081101562001d6e57600163ffffffff8616821c8116900362001d0a5785816020811062001ccb5762001ccb62003b8a565b60200201358260405160200162001cec929190918252602082015260400190565b60405160208183030381529060405280519060200120915062001d59565b8186826020811062001d205762001d2062003b8a565b602002013560405160200162001d40929190918252602082015260400190565b6040516020818303038152906040528051906020012091505b8062001d658162003be8565b91505062001c98565b50821490505b949350505050565b60685460ff161562001dba576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556040517f2261efe5aef6fedc1fd1550b25facc9181745623049c7901287030b9ad1a549790600090a1565b80600162001e216020600262003e79565b62001e2d919062003cb1565b6053541062001e68576040517fef5ccf6600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060536000815462001e7b9062003be8565b9182905550905060005b602081101562001f17578082901c60011660010362001ebd57826033826020811062001eb55762001eb562003b8a565b015550505050565b6033816020811062001ed35762001ed362003b8a565b01546040805160208101929092528101849052606001604051602081830303815290604052805190602001209250808062001f0e9062003be8565b91505062001e85565b5062001f2262003e87565b505050565b6053546068805463ffffffff909216790100000000000000000000000000000000000000000000000000027fffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffff909216919091179081905573ffffffffffffffffffffffffffffffffffffffff65010000000000909104166333d6247d62001fad62001178565b6040518263ffffffff1660e01b815260040162001fcc91815260200190565b600060405180830381600087803b15801562001fe757600080fd5b505af1158015620014a7573d6000803e3d6000fd5b6200200d8b63ffffffff1662002d10565b6068546040805160208082018e90528183018d9052825180830384018152606083019384905280519101207f257b363200000000000000000000000000000000000000000000000000000000909252606481019190915260009165010000000000900473ffffffffffffffffffffffffffffffffffffffff169063257b3632906084016020604051808303816000875af1158015620020b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620020d6919062003c97565b90508060000362002112576040517e2f6fad00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff88811661010090920416146200215c576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606854600090610100900463ffffffff166200217a5750896200217d565b508a5b620021a66200219d848c8c8c8c8c8c8c604051620008d592919062003881565b8f8f8462001c93565b620021dd576040517fe0417cec00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905262001f229084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262002d75565b600054610100900460ff166200235c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6200070362002e88565b600260015403620023d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640162001324565b6002600155565b6000620023ec600482848662003eb6565b620023f79162003ee2565b90507f2afa5331000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000821601620026765760008080808080806200245a896004818d62003eb6565b81019062002469919062003f2b565b96509650965096509650965096503373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614620024dd576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff861630146200252d576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8a851462002567576040517f03fffc4b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff89811660248301528881166044830152606482018890526084820187905260ff861660a483015260c4820185905260e48083018590528351808403909101815261010490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fd505accf000000000000000000000000000000000000000000000000000000001790529151918e1691620026229190620038e6565b6000604051808303816000865af19150503d806000811462002661576040519150601f19603f3d011682016040523d82523d6000602084013e62002666565b606091505b50505050505050505050620009c9565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f8fcbaf0c0000000000000000000000000000000000000000000000000000000014620026f2576040517fe282c0ba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080808080806200270a8a6004818e62003eb6565b81019062002719919062003f86565b975097509750975097509750975097503373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16146200278f576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff87163014620027df576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8a811660248301528981166044830152606482018990526084820188905286151560a483015260ff861660c483015260e482018590526101048083018590528351808403909101815261012490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f8fcbaf0c000000000000000000000000000000000000000000000000000000001790529151918f1691620028a39190620038e6565b6000604051808303816000865af19150503d8060008114620028e2576040519150601f19603f3d011682016040523d82523d6000602084013e620028e7565b606091505b50505050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052620014a79085907f23b872dd000000000000000000000000000000000000000000000000000000009060840162002240565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f06fdde03000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff861691620029dd9190620038e6565b600060405180830381855afa9150503d806000811462002a1a576040519150601f19603f3d011682016040523d82523d6000602084013e62002a1f565b606091505b50915091508162002a66576040518060400160405280600781526020017f4e4f5f4e414d450000000000000000000000000000000000000000000000000081525062001d74565b62001d748162002f21565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f95d89b41000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff86169162002af59190620038e6565b600060405180830381855afa9150503d806000811462002b32576040519150601f19603f3d011682016040523d82523d6000602084013e62002b37565b606091505b50915091508162002a66576040518060400160405280600981526020017f4e4f5f53594d424f4c000000000000000000000000000000000000000000000081525062001d74565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f313ce5670000000000000000000000000000000000000000000000000000000017905290516000918291829173ffffffffffffffffffffffffffffffffffffffff86169162002c019190620038e6565b600060405180830381855afa9150503d806000811462002c3e576040519150601f19603f3d011682016040523d82523d6000602084013e62002c43565b606091505b509150915081801562002c57575080516020145b62002c6457601262001d74565b8080602001905181019062001d74919062004012565b60018055565b60685460ff1662002cbd576040517f5386698100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040517f1e5e34eea33501aecf2ebec9fe0e884a40804275ea7fe10b2ba084c8374308b390600090a1565b600881901c60008181526069602052604081208054600160ff861690811b91821892839055929091908183169003620009c9576040517f646cf55800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600062002dd9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16620031119092919063ffffffff16565b80519091501562001f22578080602001905181019062002dfa919062004032565b62001f22576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840162001324565b600054610100900460ff1662002c7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6060604082511062002f435781806020019051810190620007a2919062004052565b8151602003620030d35760005b60208110801562002f9b575082818151811062002f715762002f7162003b8a565b01602001517fff000000000000000000000000000000000000000000000000000000000000001615155b1562002fb6578062002fad8162003be8565b91505062002f50565b8060000362002ffa57505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e4700000000000000000000000000006020820152919050565b60008167ffffffffffffffff81111562003018576200301862003891565b6040519080825280601f01601f19166020018201604052801562003043576020820181803683370190505b50905060005b82811015620030cb5784818151811062003067576200306762003b8a565b602001015160f81c60f81b82828151811062003087576200308762003b8a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080620030c28162003be8565b91505062003049565b509392505050565b505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e470000000000000000000000000000602082015290565b919050565b606062001d748484600085856000808673ffffffffffffffffffffffffffffffffffffffff168587604051620031489190620038e6565b60006040518083038185875af1925050503d806000811462003187576040519150601f19603f3d011682016040523d82523d6000602084013e6200318c565b606091505b50915091506200319f87838387620031aa565b979650505050505050565b60608315620032455782516000036200323d5773ffffffffffffffffffffffffffffffffffffffff85163b6200323d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162001324565b508162001d74565b62001d7483838151156200325c5781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620013249190620040d2565b611b6680620040e883390190565b803563ffffffff811681146200310c57600080fd5b73ffffffffffffffffffffffffffffffffffffffff81168114620032d857600080fd5b50565b60008060408385031215620032ef57600080fd5b620032fa83620032a0565b915060208301356200330c81620032b5565b809150509250929050565b8015158114620032d857600080fd5b60008083601f8401126200333957600080fd5b50813567ffffffffffffffff8111156200335257600080fd5b6020830191508360208285010111156200336b57600080fd5b9250929050565b6000806000806000608086880312156200338b57600080fd5b6200339686620032a0565b94506020860135620033a881620032b5565b93506040860135620033ba8162003317565b9250606086013567ffffffffffffffff811115620033d757600080fd5b620033e58882890162003326565b969995985093965092949392505050565b806104008101831015620007a257600080fd5b60008060008060008060008060008060006105208c8e0312156200342c57600080fd5b620034388d8d620033f6565b9a50620034496104008d01620032a0565b99506104208c013598506104408c013597506200346a6104608d01620032a0565b96506104808c01356200347d81620032b5565b95506200348e6104a08d01620032a0565b94506104c08c0135620034a181620032b5565b93506104e08c013592506105008c013567ffffffffffffffff811115620034c757600080fd5b620034d58e828f0162003326565b915080935050809150509295989b509295989b9093969950565b6000602082840312156200350257600080fd5b81356200350f81620032b5565b9392505050565b60ff81168114620032d857600080fd5b600080600080600080600060e0888a0312156200354257600080fd5b87356200354f8162003516565b96506200355f60208901620032a0565b955060408801356200357181620032b5565b94506200358160608901620032a0565b935060808801356200359381620032b5565b9699959850939692959460a0840135945060c09093013592915050565b600080600060608486031215620035c657600080fd5b620035d184620032a0565b92506020840135620035e381620032b5565b91506040840135620035f581620032b5565b809150509250925092565b6000602082840312156200361357600080fd5b5035919050565b600080600080600080600060a0888a0312156200363657600080fd5b6200364188620032a0565b965060208801356200365381620032b5565b9550604088013567ffffffffffffffff808211156200367157600080fd5b6200367f8b838c0162003326565b909750955060608a01359150808211156200369957600080fd5b50620036a88a828b0162003326565b9094509250506080880135620036be8162003516565b8091505092959891949750929550565b600080600080600080600060c0888a031215620036ea57600080fd5b620036f588620032a0565b965060208801356200370781620032b5565b95506040880135945060608801356200372081620032b5565b93506080880135620037328162003317565b925060a088013567ffffffffffffffff8111156200374f57600080fd5b6200375d8a828b0162003326565b989b979a50959850939692959293505050565b60008060008061046085870312156200378857600080fd5b843593506200379b8660208701620033f6565b9250620037ac6104208601620032a0565b939692955092936104400135925050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b600061010060ff8c16835263ffffffff808c16602085015273ffffffffffffffffffffffffffffffffffffffff808c166040860152818b166060860152808a166080860152508760a08501528160c0850152620038678285018789620037bd565b925080851660e085015250509a9950505050505050505050565b8183823760009101908152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60005b83811015620038dd578181015183820152602001620038c3565b50506000910152565b60008251620038fa818460208701620038c0565b9190910192915050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156200394e576200394e62003891565b604052919050565b600067ffffffffffffffff82111562003973576200397362003891565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112620039b157600080fd5b8135620039c8620039c28262003956565b62003904565b818152846020838601011115620039de57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121562003a1157600080fd5b833567ffffffffffffffff8082111562003a2a57600080fd5b62003a38878388016200399f565b9450602086013591508082111562003a4f57600080fd5b5062003a5e868287016200399f565b9250506040840135620035f58162003516565b6000815180845262003a8b816020860160208601620038c0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60608152600062003ad2606083018662003a71565b828103602084015262003ae6818662003a71565b91505060ff83166040830152949350505050565b63ffffffff86168152600073ffffffffffffffffffffffffffffffffffffffff8087166020840152808616604084015250608060608301526200319f608083018486620037bd565b73ffffffffffffffffffffffffffffffffffffffff8516815263ffffffff8416602082015260606040820152600062003b80606083018486620037bd565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820362003c1c5762003c1c62003bb9565b5060010190565b60608152600062003c39606083018789620037bd565b828103602084015262003c4e818688620037bd565b91505060ff831660408301529695505050505050565b6000835162003c78818460208801620038c0565b83519083019062003c8e818360208801620038c0565b01949350505050565b60006020828403121562003caa57600080fd5b5051919050565b81810381811115620007a257620007a262003bb9565b600061010060ff8b16835263ffffffff808b16602085015273ffffffffffffffffffffffffffffffffffffffff808b166040860152818a1660608601528089166080860152508660a08501528160c085015262003d278285018762003a71565b925080851660e085015250509998505050505050505050565b600181815b8085111562003d9f57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003d835762003d8362003bb9565b8085161562003d9157918102915b93841c939080029062003d45565b509250929050565b60008262003db857506001620007a2565b8162003dc757506000620007a2565b816001811462003de0576002811462003deb5762003e0b565b6001915050620007a2565b60ff84111562003dff5762003dff62003bb9565b50506001821b620007a2565b5060208310610133831016604e8410600b841016171562003e30575081810a620007a2565b62003e3c838362003d40565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003e715762003e7162003bb9565b029392505050565b60006200350f838362003da7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b6000808585111562003ec757600080fd5b8386111562003ed557600080fd5b5050820193919092039150565b7fffffffff00000000000000000000000000000000000000000000000000000000813581811691600485101562003f235780818660040360031b1b83161692505b505092915050565b600080600080600080600060e0888a03121562003f4757600080fd5b873562003f5481620032b5565b9650602088013562003f6681620032b5565b955060408801359450606088013593506080880135620035938162003516565b600080600080600080600080610100898b03121562003fa457600080fd5b883562003fb181620032b5565b9750602089013562003fc381620032b5565b96506040890135955060608901359450608089013562003fe38162003317565b935060a089013562003ff58162003516565b979a969950949793969295929450505060c08201359160e0013590565b6000602082840312156200402557600080fd5b81516200350f8162003516565b6000602082840312156200404557600080fd5b81516200350f8162003317565b6000602082840312156200406557600080fd5b815167ffffffffffffffff8111156200407d57600080fd5b8201601f810184136200408f57600080fd5b8051620040a0620039c28262003956565b818152856020838501011115620040b657600080fd5b620040c9826020830160208601620038c0565b95945050505050565b6020815260006200350f602083018462003a7156fe6101006040523480156200001257600080fd5b5060405162001b6638038062001b6683398101604081905262000035916200028d565b82826003620000458382620003a1565b506004620000548282620003a1565b50503360c0525060ff811660e052466080819052620000739062000080565b60a052506200046d915050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620000ad6200012e565b805160209182012060408051808201825260018152603160f81b90840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b6060600380546200013f9062000312565b80601f01602080910402602001604051908101604052809291908181526020018280546200016d9062000312565b8015620001be5780601f106200019257610100808354040283529160200191620001be565b820191906000526020600020905b815481529060010190602001808311620001a057829003601f168201915b5050505050905090565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001f057600080fd5b81516001600160401b03808211156200020d576200020d620001c8565b604051601f8301601f19908116603f01168101908282118183101715620002385762000238620001c8565b816040528381526020925086838588010111156200025557600080fd5b600091505b838210156200027957858201830151818301840152908201906200025a565b600093810190920192909252949350505050565b600080600060608486031215620002a357600080fd5b83516001600160401b0380821115620002bb57600080fd5b620002c987838801620001de565b94506020860151915080821115620002e057600080fd5b50620002ef86828701620001de565b925050604084015160ff811681146200030757600080fd5b809150509250925092565b600181811c908216806200032757607f821691505b6020821081036200034857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200039c57600081815260208120601f850160051c81016020861015620003775750805b601f850160051c820191505b81811015620003985782815560010162000383565b5050505b505050565b81516001600160401b03811115620003bd57620003bd620001c8565b620003d581620003ce845462000312565b846200034e565b602080601f8311600181146200040d5760008415620003f45750858301515b600019600386901b1c1916600185901b17855562000398565b600085815260208120601f198616915b828110156200043e578886015182559484019460019091019084016200041d565b50858210156200045d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e0516116aa620004bc6000396000610237015260008181610307015281816105c001526106a70152600061053a015260008181610379015261050401526116aa6000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806370a08231116100d8578063a457c2d71161008c578063d505accf11610066578063d505accf1461039b578063dd62ed3e146103ae578063ffa1ad74146103f457600080fd5b8063a457c2d71461034e578063a9059cbb14610361578063cd0d00961461037457600080fd5b806395d89b41116100bd57806395d89b41146102e75780639dc29fac146102ef578063a3c573eb1461030257600080fd5b806370a08231146102915780637ecebe00146102c757600080fd5b806330adf81f1161012f5780633644e515116101145780633644e51514610261578063395093511461026957806340c10f191461027c57600080fd5b806330adf81f14610209578063313ce5671461023057600080fd5b806318160ddd1161016057806318160ddd146101bd57806320606b70146101cf57806323b872dd146101f657600080fd5b806306fdde031461017c578063095ea7b31461019a575b600080fd5b610184610430565b60405161019191906113e4565b60405180910390f35b6101ad6101a8366004611479565b6104c2565b6040519015158152602001610191565b6002545b604051908152602001610191565b6101c17f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b6101ad6102043660046114a3565b6104dc565b6101c17f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610191565b6101c1610500565b6101ad610277366004611479565b61055c565b61028f61028a366004611479565b6105a8565b005b6101c161029f3660046114df565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6101c16102d53660046114df565b60056020526000908152604090205481565b610184610680565b61028f6102fd366004611479565b61068f565b6103297f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610191565b6101ad61035c366004611479565b61075e565b6101ad61036f366004611479565b61082f565b6101c17f000000000000000000000000000000000000000000000000000000000000000081565b61028f6103a9366004611501565b61083d565b6101c16103bc366004611574565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6101846040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b60606003805461043f906115a7565b80601f016020809104026020016040519081016040528092919081815260200182805461046b906115a7565b80156104b85780601f1061048d576101008083540402835291602001916104b8565b820191906000526020600020905b81548152906001019060200180831161049b57829003601f168201915b5050505050905090565b6000336104d0818585610b73565b60019150505b92915050565b6000336104ea858285610d27565b6104f5858585610dfe565b506001949350505050565b60007f00000000000000000000000000000000000000000000000000000000000000004614610537576105324661106d565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906104d090829086906105a3908790611629565b610b73565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610672576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d4272696467650000000000000000000000000000000060648201526084015b60405180910390fd5b61067c8282611135565b5050565b60606004805461043f906115a7565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610754576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d427269646765000000000000000000000000000000006064820152608401610669565b61067c8282611228565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610669565b6104f58286868403610b73565b6000336104d0818585610dfe565b834211156108cc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f546f6b656e577261707065643a3a7065726d69743a204578706972656420706560448201527f726d6974000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260056020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a9190866109268361163c565b9091555060408051602081019690965273ffffffffffffffffffffffffffffffffffffffff94851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610991610500565b6040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281019190915260428101839052606201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015610a55573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590610ad057508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610b5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f546f6b656e577261707065643a3a7065726d69743a20496e76616c696420736960448201527f676e6174757265000000000000000000000000000000000000000000000000006064820152608401610669565b610b678a8a8a610b73565b50505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8316610c15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610cb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610df85781811015610deb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610669565b610df88484848403610b73565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610ea1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610f44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610ffa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610df8565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611098610430565b8051602091820120604080518082018252600181527f310000000000000000000000000000000000000000000000000000000000000090840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b73ffffffffffffffffffffffffffffffffffffffff82166111b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610669565b80600260008282546111c49190611629565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff82166112cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015611381576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610d1a565b600060208083528351808285015260005b81811015611411578581018301518582016040015282016113f5565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461147457600080fd5b919050565b6000806040838503121561148c57600080fd5b61149583611450565b946020939093013593505050565b6000806000606084860312156114b857600080fd5b6114c184611450565b92506114cf60208501611450565b9150604084013590509250925092565b6000602082840312156114f157600080fd5b6114fa82611450565b9392505050565b600080600080600080600060e0888a03121561151c57600080fd5b61152588611450565b965061153360208901611450565b95506040880135945060608801359350608088013560ff8116811461155757600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561158757600080fd5b61159083611450565b915061159e60208401611450565b90509250929050565b600181811c908216806115bb57607f821691505b6020821081036115f4577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156104d6576104d66115fa565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361166d5761166d6115fa565b506001019056fea26469706673582212208d88fee561cff7120d381c345cfc534cef8229a272dc5809d4bbb685ad67141164736f6c63430008110033a2646970667358221220d9b3ca7b13ec80ac58634ddf0ecebe71e209a71f532614949b9e720413f50c8364736f6c63430008110033"
43
- },
44
- {
45
- "contractName": "PolygonZkEVMBridge proxy",
46
- "balance": "200000000000000000000000000",
47
- "nonce": "1",
48
- "address": "0x528e26b25a34a4A5d0dbDa1d57D318153d2ED582",
49
- "bytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461088b565b610135565b61006b6100a33660046108a6565b61017f565b3480156100b457600080fd5b506100bd6101f3565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461088b565b610231565b34801561011257600080fd5b506100bd61025e565b6101236102d4565b61013361012e6103ab565b6103b5565b565b61013d6103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481604051806020016040528060008152506000610419565b50565b61017461011b565b6101876103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101eb576101e68383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610419915050565b505050565b6101e661011b565b60006101fd6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103ab565b905090565b61022e61011b565b90565b6102396103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481610444565b60006102686103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103d9565b60606102b183836040518060600160405280602781526020016109bb602791396104a5565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6102dc6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b600061022161052a565b3660008037600080366000845af43d6000803e8080156103d4573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b61042283610552565b60008251118061042f5750805b156101e65761043e838361028c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61046d6103d9565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a16101748161059f565b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516104cf919061094d565b600060405180830381855af49150503d806000811461050a576040519150601f19603f3d011682016040523d82523d6000602084013e61050f565b606091505b5091509150610520868383876106ab565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103fd565b61055b81610753565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff8116610642576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103a2565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b6060831561074157825160000361073a5773ffffffffffffffffffffffffffffffffffffffff85163b61073a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103a2565b508161074b565b61074b838361081e565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff81163b6107f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016103a2565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610665565b81511561082e5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a29190610969565b803573ffffffffffffffffffffffffffffffffffffffff8116811461088657600080fd5b919050565b60006020828403121561089d57600080fd5b6102b182610862565b6000806000604084860312156108bb57600080fd5b6108c484610862565b9250602084013567ffffffffffffffff808211156108e157600080fd5b818601915086601f8301126108f557600080fd5b81358181111561090457600080fd5b87602082850101111561091657600080fd5b6020830194508093505050509250925092565b60005b8381101561094457818101518382015260200161092c565b50506000910152565b6000825161095f818460208701610929565b9190910192915050565b6020815260008251806020840152610988816040850160208701610929565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220a1af0d6cb4f1e31496a4c5c1448913bce4bd6ad3a39e47c6f7190c114d6f9bf464736f6c63430008110033",
50
- "storage": {
51
- "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000000000000000000000000000000000000000001",
52
- "0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000000001",
53
- "0x0000000000000000000000000000000000000000000000000000000000000068": "0x00000000000000a40d5f56745a118d0906a34e69aec8c0db1cb8fa0000000100",
54
- "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x00000000000000000000000085ceb41028b1a5ed2b88e395145344837308b251",
55
- "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x0000000000000000000000008bd36ca1a55e389335004872aa3c3be0969d3aa7"
56
- }
57
- },
58
- {
59
- "contractName": "PolygonZkEVMGlobalExitRootL2 implementation",
60
- "balance": "0",
61
- "nonce": "1",
62
- "address": "0x282a631D9F3Ef04Bf1A44B4C9e8bDC8EB278917f",
63
- "bytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806301fd904414610051578063257b36321461006d57806333d6247d1461008d578063a3c573eb146100a2575b600080fd5b61005a60015481565b6040519081526020015b60405180910390f35b61005a61007b366004610162565b60006020819052908152604090205481565b6100a061009b366004610162565b6100ee565b005b6100c97f000000000000000000000000528e26b25a34a4a5d0dbda1d57d318153d2ed58281565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610064565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000528e26b25a34a4a5d0dbda1d57d318153d2ed582161461015d576040517fb49365dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600155565b60006020828403121561017457600080fd5b503591905056fea2646970667358221220a187fc278346c1b61c449ea3641002b6eac2bda3351a122a12c35099f933696864736f6c63430008110033"
64
- },
65
- {
66
- "contractName": "PolygonZkEVMGlobalExitRootL2 proxy",
67
- "balance": "0",
68
- "nonce": "1",
69
- "address": "0xa40d5f56745a118d0906a34e69aec8c0db1cb8fa",
70
- "bytecode": "0x60806040523661001357610011610017565b005b6100115b61001f6101b7565b6001600160a01b0316336001600160a01b0316141561016f5760606001600160e01b031960003516631b2ce7f360e11b8114156100655761005e6101ea565b9150610167565b6001600160e01b0319811663278f794360e11b14156100865761005e610241565b6001600160e01b031981166308f2839760e41b14156100a75761005e610287565b6001600160e01b031981166303e1469160e61b14156100c85761005e6102b8565b6001600160e01b03198116635c60da1b60e01b14156100e95761005e6102f8565b60405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b815160208301f35b61017761030c565b565b606061019e83836040518060600160405280602781526020016108576027913961031c565b9392505050565b90565b6001600160a01b03163b151590565b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b60606101f4610394565b600061020336600481846106a2565b81019061021091906106e8565b905061022d8160405180602001604052806000815250600061039f565b505060408051602081019091526000815290565b606060008061025336600481846106a2565b8101906102609190610719565b915091506102708282600161039f565b604051806020016040528060008152509250505090565b6060610291610394565b60006102a036600481846106a2565b8101906102ad91906106e8565b905061022d816103cb565b60606102c2610394565b60006102cc6101b7565b604080516001600160a01b03831660208201529192500160405160208183030381529060405291505090565b6060610302610394565b60006102cc610422565b610177610317610422565b610431565b6060600080856001600160a01b0316856040516103399190610807565b600060405180830381855af49150503d8060008114610374576040519150601f19603f3d011682016040523d82523d6000602084013e610379565b606091505b509150915061038a86838387610455565b9695505050505050565b341561017757600080fd5b6103a8836104d3565b6000825111806103b55750805b156103c6576103c48383610179565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103f46101b7565b604080516001600160a01b03928316815291841660208301520160405180910390a161041f81610513565b50565b600061042c6105bc565b905090565b3660008037600080366000845af43d6000803e808015610450573d6000f35b3d6000fd5b606083156104c15782516104ba576001600160a01b0385163b6104ba5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161015e565b50816104cb565b6104cb83836105e4565b949350505050565b6104dc8161060e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b0381166105785760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b606482015260840161015e565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80546001600160a01b0319166001600160a01b039290921691909117905550565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6101db565b8151156105f45781518083602001fd5b8060405162461bcd60e51b815260040161015e9190610823565b6001600160a01b0381163b61067b5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161015e565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61059b565b600080858511156106b257600080fd5b838611156106bf57600080fd5b5050820193919092039150565b80356001600160a01b03811681146106e357600080fd5b919050565b6000602082840312156106fa57600080fd5b61019e826106cc565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561072c57600080fd5b610735836106cc565b9150602083013567ffffffffffffffff8082111561075257600080fd5b818501915085601f83011261076657600080fd5b81358181111561077857610778610703565b604051601f8201601f19908116603f011681019083821181831017156107a0576107a0610703565b816040528281528860208487010111156107b957600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b838110156107f65781810151838201526020016107de565b838111156103c45750506000910152565b600082516108198184602087016107db565b9190910192915050565b60208152600082518060208401526108428160408501602087016107db565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122012bb4f564f73959a03513dc74fc3c6e40e8386e6f02c16b78d6db00ce0aa16af64736f6c63430008090033",
71
- "storage": {
72
- "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x00000000000000000000000085ceb41028b1a5ed2b88e395145344837308b251",
73
- "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x000000000000000000000000282a631d9f3ef04bf1a44b4c9e8bdc8eb278917f"
74
- }
75
- },
76
- {
77
- "contractName": "PolygonZkEVMTimelock",
78
- "balance": "0",
79
- "nonce": "1",
80
- "address": "0xdbC6981a11fc2B000c635bFA7C47676b25C87D39",
81
- "bytecode": "0x6080604052600436106101c65760003560e01c806364d62353116100f7578063b1c5f42711610095578063d547741f11610064578063d547741f14610661578063e38335e514610681578063f23a6e6114610694578063f27a0c92146106d957600080fd5b8063b1c5f427146105af578063bc197c81146105cf578063c4d252f514610614578063d45c44351461063457600080fd5b80638f61f4f5116100d15780638f61f4f5146104e157806391d1485414610515578063a217fddf14610566578063b08e51c01461057b57600080fd5b806364d62353146104815780638065657f146104a15780638f2a0bb0146104c157600080fd5b8063248a9ca31161016457806331d507501161013e57806331d50750146103c857806336568abe146103e85780633a6aae7214610408578063584b153e1461046157600080fd5b8063248a9ca3146103475780632ab0f529146103775780632f2ff15d146103a857600080fd5b80630d3cf6fc116101a05780630d3cf6fc1461026b578063134008d31461029f57806313bc9f20146102b2578063150b7a02146102d257600080fd5b806301d5062a146101d257806301ffc9a7146101f457806307bd02651461022957600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed366004611c52565b6106ee565b005b34801561020057600080fd5b5061021461020f366004611cc7565b610783565b60405190151581526020015b60405180910390f35b34801561023557600080fd5b5061025d7fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e6381565b604051908152602001610220565b34801561027757600080fd5b5061025d7f5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca581565b6101f26102ad366004611d09565b6107df565b3480156102be57600080fd5b506102146102cd366004611d75565b6108d7565b3480156102de57600080fd5b506103166102ed366004611e9a565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610220565b34801561035357600080fd5b5061025d610362366004611d75565b60009081526020819052604090206001015490565b34801561038357600080fd5b50610214610392366004611d75565b6000908152600160208190526040909120541490565b3480156103b457600080fd5b506101f26103c3366004611f02565b6108fd565b3480156103d457600080fd5b506102146103e3366004611d75565b610927565b3480156103f457600080fd5b506101f2610403366004611f02565b610940565b34801561041457600080fd5b5061043c7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610220565b34801561046d57600080fd5b5061021461047c366004611d75565b6109f8565b34801561048d57600080fd5b506101f261049c366004611d75565b610a0e565b3480156104ad57600080fd5b5061025d6104bc366004611d09565b610ade565b3480156104cd57600080fd5b506101f26104dc366004611f73565b610b1d565b3480156104ed57600080fd5b5061025d7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc181565b34801561052157600080fd5b50610214610530366004611f02565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b34801561057257600080fd5b5061025d600081565b34801561058757600080fd5b5061025d7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f78381565b3480156105bb57600080fd5b5061025d6105ca366004612025565b610d4f565b3480156105db57600080fd5b506103166105ea36600461214e565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b34801561062057600080fd5b506101f261062f366004611d75565b610d94565b34801561064057600080fd5b5061025d61064f366004611d75565b60009081526001602052604090205490565b34801561066d57600080fd5b506101f261067c366004611f02565b610e8f565b6101f261068f366004612025565b610eb4565b3480156106a057600080fd5b506103166106af3660046121f8565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b3480156106e557600080fd5b5061025d611161565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc161071881611244565b6000610728898989898989610ade565b90506107348184611251565b6000817f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8b8b8b8b8b8a604051610770969594939291906122a6565b60405180910390a3505050505050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e00000000000000000000000000000000000000000000000000000000014806107d957506107d98261139e565b92915050565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff1661085c5761085c8133611435565b600061086c888888888888610ade565b905061087881856114ed565b6108848888888861162a565b6000817fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588a8a8a8a6040516108bc94939291906122f1565b60405180910390a36108cd8161172e565b5050505050505050565b6000818152600160205260408120546001811180156108f65750428111155b9392505050565b60008281526020819052604090206001015461091881611244565b61092283836117d7565b505050565b60008181526001602052604081205481905b1192915050565b73ffffffffffffffffffffffffffffffffffffffff811633146109ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6109f482826118c7565b5050565b6000818152600160208190526040822054610939565b333014610a9d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f54696d656c6f636b436f6e74726f6c6c65723a2063616c6c6572206d7573742060448201527f62652074696d656c6f636b00000000000000000000000000000000000000000060648201526084016109e1565b60025460408051918252602082018390527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1600255565b6000868686868686604051602001610afb969594939291906122a6565b6040516020818303038152906040528051906020012090509695505050505050565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1610b4781611244565b888714610bd6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b888514610c65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b6000610c778b8b8b8b8b8b8b8b610d4f565b9050610c838184611251565b60005b8a811015610d415780827f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8e8e85818110610cc357610cc3612331565b9050602002016020810190610cd89190612360565b8d8d86818110610cea57610cea612331565b905060200201358c8c87818110610d0357610d03612331565b9050602002810190610d15919061237b565b8c8b604051610d29969594939291906122a6565b60405180910390a3610d3a8161240f565b9050610c86565b505050505050505050505050565b60008888888888888888604051602001610d709897969594939291906124f7565b60405160208183030381529060405280519060200120905098975050505050505050565b7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783610dbe81611244565b610dc7826109f8565b610e53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20636160448201527f6e6e6f742062652063616e63656c6c656400000000000000000000000000000060648201526084016109e1565b6000828152600160205260408082208290555183917fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb7091a25050565b600082815260208190526040902060010154610eaa81611244565b61092283836118c7565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff16610f3157610f318133611435565b878614610fc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b87841461104f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b60006110618a8a8a8a8a8a8a8a610d4f565b905061106d81856114ed565b60005b8981101561114b5760008b8b8381811061108c5761108c612331565b90506020020160208101906110a19190612360565b905060008a8a848181106110b7576110b7612331565b9050602002013590503660008a8a868181106110d5576110d5612331565b90506020028101906110e7919061237b565b915091506110f78484848461162a565b84867fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588686868660405161112e94939291906122f1565b60405180910390a350505050806111449061240f565b9050611070565b506111558161172e565b50505050505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff161580159061123257507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166315064c966040518163ffffffff1660e01b8152600401602060405180830381865afa15801561120e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123291906125be565b1561123d5750600090565b5060025490565b61124e8133611435565b50565b61125a82610927565b156112e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20616c60448201527f7265616479207363686564756c6564000000000000000000000000000000000060648201526084016109e1565b6112ef611161565b81101561137e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a20696e73756666696369656e7460448201527f2064656c6179000000000000000000000000000000000000000000000000000060648201526084016109e1565b61138881426125e0565b6000928352600160205260409092209190915550565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806107d957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107d9565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f4576114738161197e565b61147e83602061199d565b60405160200161148f929190612617565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526109e191600401612698565b6114f6826108d7565b611582576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b80158061159e5750600081815260016020819052604090912054145b6109f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a206d697373696e67206465706560448201527f6e64656e6379000000000000000000000000000000000000000000000000000060648201526084016109e1565b60008473ffffffffffffffffffffffffffffffffffffffff168484846040516116549291906126e9565b60006040518083038185875af1925050503d8060008114611691576040519150601f19603f3d011682016040523d82523d6000602084013e611696565b606091505b5050905080611727576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f54696d656c6f636b436f6e74726f6c6c65723a20756e6465726c79696e67207460448201527f72616e73616374696f6e2072657665727465640000000000000000000000000060648201526084016109e1565b5050505050565b611737816108d7565b6117c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b600090815260016020819052604090912055565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556118693390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606107d973ffffffffffffffffffffffffffffffffffffffff831660145b606060006119ac8360026126f9565b6119b79060026125e0565b67ffffffffffffffff8111156119cf576119cf611d8e565b6040519080825280601f01601f1916602001820160405280156119f9576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611a3057611a30612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611a9357611a93612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611acf8460026126f9565b611ada9060016125e0565b90505b6001811115611b77577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611b1b57611b1b612331565b1a60f81b828281518110611b3157611b31612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611b7081612710565b9050611add565b5083156108f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109e1565b803573ffffffffffffffffffffffffffffffffffffffff81168114611c0457600080fd5b919050565b60008083601f840112611c1b57600080fd5b50813567ffffffffffffffff811115611c3357600080fd5b602083019150836020828501011115611c4b57600080fd5b9250929050565b600080600080600080600060c0888a031215611c6d57600080fd5b611c7688611be0565b965060208801359550604088013567ffffffffffffffff811115611c9957600080fd5b611ca58a828b01611c09565b989b979a50986060810135976080820135975060a09091013595509350505050565b600060208284031215611cd957600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146108f657600080fd5b60008060008060008060a08789031215611d2257600080fd5b611d2b87611be0565b955060208701359450604087013567ffffffffffffffff811115611d4e57600080fd5b611d5a89828a01611c09565b979a9699509760608101359660809091013595509350505050565b600060208284031215611d8757600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611e0457611e04611d8e565b604052919050565b600082601f830112611e1d57600080fd5b813567ffffffffffffffff811115611e3757611e37611d8e565b611e6860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611dbd565b818152846020838601011115611e7d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215611eb057600080fd5b611eb985611be0565b9350611ec760208601611be0565b925060408501359150606085013567ffffffffffffffff811115611eea57600080fd5b611ef687828801611e0c565b91505092959194509250565b60008060408385031215611f1557600080fd5b82359150611f2560208401611be0565b90509250929050565b60008083601f840112611f4057600080fd5b50813567ffffffffffffffff811115611f5857600080fd5b6020830191508360208260051b8501011115611c4b57600080fd5b600080600080600080600080600060c08a8c031215611f9157600080fd5b893567ffffffffffffffff80821115611fa957600080fd5b611fb58d838e01611f2e565b909b50995060208c0135915080821115611fce57600080fd5b611fda8d838e01611f2e565b909950975060408c0135915080821115611ff357600080fd5b506120008c828d01611f2e565b9a9d999c50979a969997986060880135976080810135975060a0013595509350505050565b60008060008060008060008060a0898b03121561204157600080fd5b883567ffffffffffffffff8082111561205957600080fd5b6120658c838d01611f2e565b909a50985060208b013591508082111561207e57600080fd5b61208a8c838d01611f2e565b909850965060408b01359150808211156120a357600080fd5b506120b08b828c01611f2e565b999c989b509699959896976060870135966080013595509350505050565b600082601f8301126120df57600080fd5b8135602067ffffffffffffffff8211156120fb576120fb611d8e565b8160051b61210a828201611dbd565b928352848101820192828101908785111561212457600080fd5b83870192505b848310156121435782358252918301919083019061212a565b979650505050505050565b600080600080600060a0868803121561216657600080fd5b61216f86611be0565b945061217d60208701611be0565b9350604086013567ffffffffffffffff8082111561219a57600080fd5b6121a689838a016120ce565b945060608801359150808211156121bc57600080fd5b6121c889838a016120ce565b935060808801359150808211156121de57600080fd5b506121eb88828901611e0c565b9150509295509295909350565b600080600080600060a0868803121561221057600080fd5b61221986611be0565b945061222760208701611be0565b93506040860135925060608601359150608086013567ffffffffffffffff81111561225157600080fd5b6121eb88828901611e0c565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b73ffffffffffffffffffffffffffffffffffffffff8716815285602082015260a0604082015260006122dc60a08301868861225d565b60608301949094525060800152949350505050565b73ffffffffffffffffffffffffffffffffffffffff8516815283602082015260606040820152600061232760608301848661225d565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561237257600080fd5b6108f682611be0565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126123b057600080fd5b83018035915067ffffffffffffffff8211156123cb57600080fd5b602001915036819003821315611c4b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612440576124406123e0565b5060010190565b81835260006020808501808196508560051b810191508460005b878110156124ea57828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18836030181126124a057600080fd5b8701858101903567ffffffffffffffff8111156124bc57600080fd5b8036038213156124cb57600080fd5b6124d686828461225d565b9a87019a9550505090840190600101612461565b5091979650505050505050565b60a0808252810188905260008960c08301825b8b8110156125455773ffffffffffffffffffffffffffffffffffffffff61253084611be0565b1682526020928301929091019060010161250a565b5083810360208501528881527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff89111561257e57600080fd5b8860051b9150818a602083013701828103602090810160408501526125a69082018789612447565b60608401959095525050608001529695505050505050565b6000602082840312156125d057600080fd5b815180151581146108f657600080fd5b808201808211156107d9576107d96123e0565b60005b8381101561260e5781810151838201526020016125f6565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161264f8160178501602088016125f3565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161268c8160288401602088016125f3565b01602801949350505050565b60208152600082518060208401526126b78160408501602087016125f3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b8183823760009101908152919050565b80820281158282048414176107d9576107d96123e0565b60008161271f5761271f6123e0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea26469706673582212206416c4e08f97752b4bb06159524dac058d3dccd8775e57ef1b01505751ebf7af64736f6c63430008110033",
82
- "storage": {
83
- "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000000e10",
84
- "0xf587dde6f8846415188f807710a3304f72092565918b30307d60efdc8014f20b": "0x0000000000000000000000000000000000000000000000000000000000000001",
85
- "0x07020fe9de9b8274d1e6cc0668a6f6344a870f35e5a847590c8069dfa85ac78f": "0x0000000000000000000000000000000000000000000000000000000000000001",
86
- "0x64494413541ff93b31aa309254e3fed72a7456e9845988b915b4c7a7ceba8814": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5",
87
- "0xc8e266e0814671642b74f3807affd27009fcc23f713ea92d1743e0ee0c1e7603": "0x0000000000000000000000000000000000000000000000000000000000000001",
88
- "0x3412d5605ac6cd444957cedb533e5dacad6378b4bc819ebe3652188a665066d6": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5",
89
- "0x9b3efc411c5f69533db363941e091f6f3af8b7e306525413577a56d27e5dbe73": "0x0000000000000000000000000000000000000000000000000000000000000001",
90
- "0xdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d706a": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5",
91
- "0xa2001bdd6a5944149e83176d089ee9a8246bd56aecf38fe4d6c66f5fbac18675": "0x0000000000000000000000000000000000000000000000000000000000000001",
92
- "0xc3ad33e20b0c56a223ad5104fff154aa010f8715b9c981fd38fdc60a4d1a52fc": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5"
93
- }
94
- },
95
- {
96
- "accountName": "keyless Deployer",
97
- "balance": "0",
98
- "nonce": "1",
99
- "address": "0x1754175c450BEbB9B6E14dEe542649c0402A25d2"
100
- },
101
- {
102
- "accountName": "deployer",
103
- "balance": "100000000000000000000000",
104
- "nonce": "8",
105
- "address": "0xff6250d0E86A2465B0C1bF8e36409503d6a26963"
106
- }
107
- ]
108
- }
109
- `
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
{/home/stefan/go/src/Polygon/zkevm-node → .}/config/config.go RENAMED
@@ -2,6 +2,8 @@
2
 
3
  import (
4
  "bytes"
 
 
5
  "path/filepath"
6
  "strings"
7
 
@@ -21,6 +24,7 @@
21
  "github.com/0xPolygonHermez/zkevm-node/state"
22
  "github.com/0xPolygonHermez/zkevm-node/state/runtime/executor"
23
  "github.com/0xPolygonHermez/zkevm-node/synchronizer"
 
24
  "github.com/mitchellh/mapstructure"
25
  "github.com/spf13/viper"
26
  "github.com/urfave/cli/v2"
@@ -31,7 +35,7 @@
31
  FlagYes = "yes"
32
  // FlagCfg is the flag for cfg.
33
  FlagCfg = "cfg"
34
- // FlagNetwork is the flag for the network name. Valid values: ["testnet", "mainnet", "cardona", "custom"].
35
  FlagNetwork = "network"
36
  // FlagCustomNetwork is the flag for the custom network file. This is required if --network=custom
37
  FlagCustomNetwork = "custom-network-file"
@@ -183,3 +187,19 @@
183
  }
184
  return cfg, nil
185
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  import (
4
  "bytes"
5
+ "crypto/ecdsa"
6
+ "os"
7
  "path/filepath"
8
  "strings"
9
 
 
24
  "github.com/0xPolygonHermez/zkevm-node/state"
25
  "github.com/0xPolygonHermez/zkevm-node/state/runtime/executor"
26
  "github.com/0xPolygonHermez/zkevm-node/synchronizer"
27
+ "github.com/ethereum/go-ethereum/accounts/keystore"
28
  "github.com/mitchellh/mapstructure"
29
  "github.com/spf13/viper"
30
  "github.com/urfave/cli/v2"
 
35
  FlagYes = "yes"
36
  // FlagCfg is the flag for cfg.
37
  FlagCfg = "cfg"
38
+ // FlagNetwork is the flag for the network name. Valid values: ["custom"].
39
  FlagNetwork = "network"
40
  // FlagCustomNetwork is the flag for the custom network file. This is required if --network=custom
41
  FlagCustomNetwork = "custom-network-file"
 
187
  }
188
  return cfg, nil
189
  }
190
+
191
+ // NewKeyFromKeystore creates a private key from a keystore file
192
+ func NewKeyFromKeystore(cfg types.KeystoreFileConfig) (*ecdsa.PrivateKey, error) {
193
+ if cfg.Path == "" && cfg.Password == "" {
194
+ return nil, nil
195
+ }
196
+ keystoreEncrypted, err := os.ReadFile(filepath.Clean(cfg.Path))
197
+ if err != nil {
198
+ return nil, err
199
+ }
200
+ key, err := keystore.DecryptKey(keystoreEncrypted, cfg.Password)
201
+ if err != nil {
202
+ return nil, err
203
+ }
204
+ return key.PrivateKey, nil
205
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/config/config_test.go RENAMED
@@ -65,6 +66,10 @@
65
  expectedValue: true,
66
  },
67
  {
 
 
 
 
68
  path: "Synchronizer.L1BlockCheck.Enabled",
69
  expectedValue: true,
70
  },
@@ -76,7 +81,6 @@
76
  path: "Synchronizer.L2Synchronization.Enabled",
77
  expectedValue: true,
78
  },
79
-
80
  {
81
  path: "Sequencer.DeletePoolTxsL1BlockConfirmations",
82
  expectedValue: uint64(100),
@@ -198,6 +202,10 @@
198
  expectedValue: uint64(80000),
199
  },
200
  {
 
 
 
 
201
  path: "SequenceSender.SequenceL1BlockConfirmations",
202
  expectedValue: uint64(32),
203
  },
@@ -207,19 +215,19 @@
207
  },
208
  {
209
  path: "NetworkConfig.L1Config.L1ChainID",
210
- expectedValue: uint64(5),
211
  },
212
  {
213
  path: "NetworkConfig.L1Config.ZkEVMAddr",
214
- expectedValue: common.HexToAddress("0xa997cfD539E703921fD1e3Cf25b4c241a27a4c7A"),
215
  },
216
  {
217
  path: "NetworkConfig.L1Config.PolAddr",
218
- expectedValue: common.HexToAddress("0x1319D23c2F7034F52Eb07399702B040bA278Ca49"),
219
  },
220
  {
221
  path: "NetworkConfig.L1Config.GlobalExitRootManagerAddr",
222
- expectedValue: common.HexToAddress("0x4d9427DCA0406358445bC0a8F88C26b704004f74"),
223
  },
224
  {
225
  path: "Etherman.MultiGasProvider",
@@ -579,7 +587,8 @@
579
  require.NoError(t, os.WriteFile(file.Name(), []byte("{}"), 0600))
580
 
581
  flagSet := flag.NewFlagSet("", flag.PanicOnError)
582
- flagSet.String(config.FlagNetwork, "testnet", "")
 
583
  ctx := cli.NewContext(cli.NewApp(), flagSet, nil)
584
  cfg, err := config.Load(ctx, true)
585
  if err != nil {
@@ -617,7 +626,8 @@
617
  }()
618
  require.NoError(t, os.WriteFile(file.Name(), []byte("{}"), 0600))
619
  flagSet := flag.NewFlagSet("", flag.PanicOnError)
620
- flagSet.String(config.FlagNetwork, "testnet", "")
 
621
  ctx := cli.NewContext(cli.NewApp(), flagSet, nil)
622
 
623
  os.Setenv("ZKEVM_NODE_LOG_OUTPUTS", "a,b,c")
 
66
  expectedValue: true,
67
  },
68
  {
69
+ path: "Synchronizer.L2Synchronization.DataSourcePriority",
70
+ expectedValue: []dataavailability.DataSourcePriority{"local", "trusted", "external"},
71
+ },
72
+ {
73
  path: "Synchronizer.L1BlockCheck.Enabled",
74
  expectedValue: true,
75
  },
 
81
  path: "Synchronizer.L2Synchronization.Enabled",
82
  expectedValue: true,
83
  },
 
84
  {
85
  path: "Sequencer.DeletePoolTxsL1BlockConfirmations",
86
  expectedValue: uint64(100),
 
202
  expectedValue: uint64(80000),
203
  },
204
  {
205
+ path: "SequenceSender.MaxBatchesForL1",
206
+ expectedValue: uint64(300),
207
+ },
208
+ {
209
  path: "SequenceSender.SequenceL1BlockConfirmations",
210
  expectedValue: uint64(32),
211
  },
 
215
  },
216
  {
217
  path: "NetworkConfig.L1Config.L1ChainID",
218
+ expectedValue: uint64(1337),
219
  },
220
  {
221
  path: "NetworkConfig.L1Config.ZkEVMAddr",
222
+ expectedValue: common.HexToAddress("0x8dAF17A20c9DBA35f005b6324F493785D239719d"),
223
  },
224
  {
225
  path: "NetworkConfig.L1Config.PolAddr",
226
+ expectedValue: common.HexToAddress("0x5FbDB2315678afecb367f032d93F642f64180aa3"),
227
  },
228
  {
229
  path: "NetworkConfig.L1Config.GlobalExitRootManagerAddr",
230
+ expectedValue: common.HexToAddress("0x8A791620dd6260079BF849Dc5567aDC3F2FdC318"),
231
  },
232
  {
233
  path: "Etherman.MultiGasProvider",
 
587
  require.NoError(t, os.WriteFile(file.Name(), []byte("{}"), 0600))
588
 
589
  flagSet := flag.NewFlagSet("", flag.PanicOnError)
590
+ flagSet.String(config.FlagNetwork, "custom", "")
591
+ flagSet.String(config.FlagCustomNetwork, "../test/config/test.genesis.config.json", "")
592
  ctx := cli.NewContext(cli.NewApp(), flagSet, nil)
593
  cfg, err := config.Load(ctx, true)
594
  if err != nil {
 
626
  }()
627
  require.NoError(t, os.WriteFile(file.Name(), []byte("{}"), 0600))
628
  flagSet := flag.NewFlagSet("", flag.PanicOnError)
629
+ flagSet.String(config.FlagNetwork, "custom", "")
630
+ flagSet.String(config.FlagCustomNetwork, "../test/config/test.genesis.config.json", "")
631
  ctx := cli.NewContext(cli.NewApp(), flagSet, nil)
632
 
633
  os.Setenv("ZKEVM_NODE_LOG_OUTPUTS", "a,b,c")
{/home/stefan/go/src/Polygon/zkevm-node → .}/config/default.go RENAMED
@@ -133,6 +133,7 @@
133
  AcceptEmptyClosedBatches = false
134
  ReprocessFullBatchOnClose = false
135
  CheckLastL2BlockHashOnCloseBatch = true
 
136
 
137
  [Sequencer]
138
  DeletePoolTxsL1BlockConfirmations = 100
@@ -175,6 +176,7 @@
175
  L2Coinbase = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"
176
  PrivateKey = {Path = "/pk/sequencer.keystore", Password = "testonly"}
177
  GasOffset = 80000
 
178
 
179
  [Aggregator]
180
  Host = "0.0.0.0"
@@ -189,6 +191,10 @@
189
  GasOffset = 0
190
  UpgradeEtrogBatchNumber = 0
191
  BatchProofL1BlockConfirmations = 2
 
 
 
 
192
 
193
  [L2GasPriceSuggester]
194
  Type = "follower"
 
133
  AcceptEmptyClosedBatches = false
134
  ReprocessFullBatchOnClose = false
135
  CheckLastL2BlockHashOnCloseBatch = true
136
+ DataSourcePriority = ["local","trusted","external"]
137
 
138
  [Sequencer]
139
  DeletePoolTxsL1BlockConfirmations = 100
 
176
  L2Coinbase = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"
177
  PrivateKey = {Path = "/pk/sequencer.keystore", Password = "testonly"}
178
  GasOffset = 80000
179
+ MaxBatchesForL1 = 300
180
 
181
  [Aggregator]
182
  Host = "0.0.0.0"
 
191
  GasOffset = 0
192
  UpgradeEtrogBatchNumber = 0
193
  BatchProofL1BlockConfirmations = 2
194
+ SettlementBackend = "agglayer"
195
+ AggLayerTxTimeout = "5m"
196
+ AggLayerURL = "http://zkevm-agglayer"
197
+ SequencerPrivateKey = {Path = "/pk/sequencer.keystore", Password = "testonly"}
198
 
199
  [L2GasPriceSuggester]
200
  Type = "follower"
{/home/stefan/go/src/Polygon/zkevm-node → .}/config/mainnetgenesis.go RENAMED
@@ -1,108 +0,0 @@
1
- package config
2
-
3
- // MainnetNetworkConfigJSON is the hardcoded network configuration to be used for the official mainnet setup
4
- const MainnetNetworkConfigJSON = `
5
- {
6
- "l1Config" : {
7
- "chainId": 1,
8
- "polygonZkEVMAddress": "0x519E42c24163192Dca44CD3fBDCEBF6be9130987",
9
- "polygonRollupManagerAddress": "0x5132A183E9F3CB7C848b0AAC5Ae0c4f0491B7aB2",
10
- "polTokenAddress": "0x455e53CBB86018Ac2B8092FdCd39d8444aFFC3F6",
11
- "polygonZkEVMGlobalExitRootAddress": "0x580bda1e7A0CFAe92Fa7F6c20A3794F169CE3CFb"
12
- },
13
- "root": "0x3f86b09b43e3e49a41fc20a07579b79eba044253367817d5c241d23c0e2bc5c9",
14
- "genesisBlockNumber": 16896721,
15
- "genesis": [
16
- {
17
- "contractName": "PolygonZkEVMDeployer",
18
- "balance": "0",
19
- "nonce": "4",
20
- "address": "0xCB19eDdE626906eB1EE52357a27F62dd519608C2",
21
- "bytecode": "0x6080604052600436106100705760003560e01c8063715018a61161004e578063715018a6146100e65780638da5cb5b146100fb578063e11ae6cb14610126578063f2fde38b1461013957600080fd5b80632b79805a146100755780634a94d4871461008a5780636d07dbf81461009d575b600080fd5b610088610083366004610927565b610159565b005b6100886100983660046109c7565b6101cb565b3480156100a957600080fd5b506100bd6100b8366004610a1e565b61020d565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b50610088610220565b34801561010757600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100bd565b610088610134366004610a40565b610234565b34801561014557600080fd5b50610088610154366004610a90565b61029b565b610161610357565b600061016e8585856103d8565b905061017a8183610537565b5060405173ffffffffffffffffffffffffffffffffffffffff821681527fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a15050505050565b6101d3610357565b6101de83838361057b565b506040517f25adb19089b6a549831a273acdf7908cff8b7ee5f551f8d1d37996cf01c5df5b90600090a1505050565b600061021983836105a9565b9392505050565b610228610357565b61023260006105b6565b565b61023c610357565b60006102498484846103d8565b60405173ffffffffffffffffffffffffffffffffffffffff821681529091507fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a150505050565b6102a3610357565b73ffffffffffffffffffffffffffffffffffffffff811661034b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610354816105b6565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610232576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610342565b600083471015610444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e63650000006044820152606401610342565b81516000036104af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152606401610342565b8282516020840186f5905073ffffffffffffffffffffffffffffffffffffffff8116610219576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152606401610342565b6060610219838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c6564000081525061062b565b60606105a1848484604051806060016040528060298152602001610b3d6029913961062b565b949350505050565b6000610219838330610744565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060824710156106bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610342565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516106e69190610acf565b60006040518083038185875af1925050503d8060008114610723576040519150601f19603f3d011682016040523d82523d6000602084013e610728565b606091505b50915091506107398783838761076e565b979650505050505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b606083156108045782516000036107fd5773ffffffffffffffffffffffffffffffffffffffff85163b6107fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610342565b50816105a1565b6105a183838151156108195781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103429190610aeb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261088d57600080fd5b813567ffffffffffffffff808211156108a8576108a861084d565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156108ee576108ee61084d565b8160405283815286602085880101111561090757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806080858703121561093d57600080fd5b8435935060208501359250604085013567ffffffffffffffff8082111561096357600080fd5b61096f8883890161087c565b9350606087013591508082111561098557600080fd5b506109928782880161087c565b91505092959194509250565b803573ffffffffffffffffffffffffffffffffffffffff811681146109c257600080fd5b919050565b6000806000606084860312156109dc57600080fd5b6109e58461099e565b9250602084013567ffffffffffffffff811115610a0157600080fd5b610a0d8682870161087c565b925050604084013590509250925092565b60008060408385031215610a3157600080fd5b50508035926020909101359150565b600080600060608486031215610a5557600080fd5b8335925060208401359150604084013567ffffffffffffffff811115610a7a57600080fd5b610a868682870161087c565b9150509250925092565b600060208284031215610aa257600080fd5b6102198261099e565b60005b83811015610ac6578181015183820152602001610aae565b50506000910152565b60008251610ae1818460208701610aab565b9190910192915050565b6020815260008251806020840152610b0a816040850160208701610aab565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a26469706673582212203e70ce334e8ec9d8d03e87415afd36dce4e82633bd277b08937095a6bd66367764736f6c63430008110033",
22
- "storage": {
23
- "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000004c1665d6651ecefa59b9b3041951608468b18891"
24
- }
25
- },
26
- {
27
- "contractName": "ProxyAdmin",
28
- "balance": "0",
29
- "nonce": "1",
30
- "address": "0x0F99738B2Fc14D77308337f3e2596b63aE7BCC4A",
31
- "bytecode": "0x60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461012b57806399a88ec41461013e578063f2fde38b1461015e578063f3b7dead1461017e57600080fd5b8063204e1c7a14610080578063715018a6146100c95780637eff275e146100e05780638da5cb5b14610100575b600080fd5b34801561008c57600080fd5b506100a061009b366004610608565b61019e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100d557600080fd5b506100de610255565b005b3480156100ec57600080fd5b506100de6100fb36600461062c565b610269565b34801561010c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100a0565b6100de610139366004610694565b6102f7565b34801561014a57600080fd5b506100de61015936600461062c565b61038c565b34801561016a57600080fd5b506100de610179366004610608565b6103e8565b34801561018a57600080fd5b506100a0610199366004610608565b6104a4565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907f5c60da1b00000000000000000000000000000000000000000000000000000000815260040190565b600060405180830381855afa9150503d8060008114610225576040519150601f19603f3d011682016040523d82523d6000602084013e61022a565b606091505b50915091508161023957600080fd5b8080602001905181019061024d9190610788565b949350505050565b61025d6104f0565b6102676000610571565b565b6102716104f0565b6040517f8f28397000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690638f283970906024015b600060405180830381600087803b1580156102db57600080fd5b505af11580156102ef573d6000803e3d6000fd5b505050505050565b6102ff6104f0565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef28690349061035590869086906004016107a5565b6000604051808303818588803b15801561036e57600080fd5b505af1158015610382573d6000803e3d6000fd5b5050505050505050565b6103946104f0565b6040517f3659cfe600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690633659cfe6906024016102c1565b6103f06104f0565b73ffffffffffffffffffffffffffffffffffffffff8116610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6104a181610571565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907ff851a44000000000000000000000000000000000000000000000000000000000815260040190565b60005473ffffffffffffffffffffffffffffffffffffffff163314610267576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161048f565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff811681146104a157600080fd5b60006020828403121561061a57600080fd5b8135610625816105e6565b9392505050565b6000806040838503121561063f57600080fd5b823561064a816105e6565b9150602083013561065a816105e6565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156106a957600080fd5b83356106b4816105e6565b925060208401356106c4816105e6565b9150604084013567ffffffffffffffff808211156106e157600080fd5b818601915086601f8301126106f557600080fd5b81358181111561070757610707610665565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561074d5761074d610665565b8160405282815289602084870101111561076657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60006020828403121561079a57600080fd5b8151610625816105e6565b73ffffffffffffffffffffffffffffffffffffffff8316815260006020604081840152835180604085015260005b818110156107ef578581018301518582016060015282016107d3565b5060006060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010192505050939250505056fea2646970667358221220372a0e10eebea1b7fa43ae4c976994e6ed01d85eedc3637b83f01d3f06be442064736f6c63430008110033",
32
- "storage": {
33
- "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000bba0935fa93eb23de7990b47f0d96a8f75766d13"
34
- }
35
- },
36
- {
37
- "contractName": "PolygonZkEVMBridge implementation",
38
- "balance": "0",
39
- "nonce": "1",
40
- "address": "0x5ac4182A1dd41AeEf465E40B82fd326BF66AB82C",
41
- "bytecode": "0x6080604052600436106200019f5760003560e01c8063647c576c11620000e7578063be5831c71162000089578063dbc169761162000060578063dbc169761462000639578063ee25560b1462000651578063fb570834146200068257600080fd5b8063be5831c714620005ae578063cd58657914620005ea578063d02103ca146200060157600080fd5b80639e34070f11620000be5780639e34070f146200050a578063aaa13cc2146200054f578063bab161bf146200057457600080fd5b8063647c576c146200048657806379e2cf9714620004ab57806381b1c17414620004c357600080fd5b80632d2c9d94116200015157806334ac9cf2116200012857806334ac9cf2146200034b5780633ae05047146200037a5780633e197043146200039257600080fd5b80632d2c9d9414620002765780632dfdf0b5146200029b578063318aee3d14620002c257600080fd5b806322e95f2c116200018657806322e95f2c14620001ef578063240ff378146200023a5780632cffd02e146200025157600080fd5b806315064c9614620001a45780632072f6c514620001d5575b600080fd5b348015620001b157600080fd5b50606854620001c09060ff1681565b60405190151581526020015b60405180910390f35b348015620001e257600080fd5b50620001ed620006a7565b005b348015620001fc57600080fd5b50620002146200020e366004620032db565b62000705565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001620001cc565b620001ed6200024b36600462003372565b620007a8565b3480156200025e57600080fd5b50620001ed6200027036600462003409565b620009d0565b3480156200028357600080fd5b50620001ed6200029536600462003409565b62000f74565b348015620002a857600080fd5b50620002b360535481565b604051908152602001620001cc565b348015620002cf57600080fd5b5062000319620002e1366004620034ef565b606b6020526000908152604090205463ffffffff811690640100000000900473ffffffffffffffffffffffffffffffffffffffff1682565b6040805163ffffffff909316835273ffffffffffffffffffffffffffffffffffffffff909116602083015201620001cc565b3480156200035857600080fd5b50606c54620002149073ffffffffffffffffffffffffffffffffffffffff1681565b3480156200038757600080fd5b50620002b362001178565b3480156200039f57600080fd5b50620002b3620003b136600462003526565b6040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b3480156200049357600080fd5b50620001ed620004a5366004620035b0565b6200125e565b348015620004b857600080fd5b50620001ed620014ad565b348015620004d057600080fd5b5062000214620004e236600462003600565b606a6020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200051757600080fd5b50620001c06200052936600462003600565b600881901c600090815260696020526040902054600160ff9092169190911b9081161490565b3480156200055c57600080fd5b50620002146200056e3660046200361a565b620014e7565b3480156200058157600080fd5b506068546200059890610100900463ffffffff1681565b60405163ffffffff9091168152602001620001cc565b348015620005bb57600080fd5b506068546200059890790100000000000000000000000000000000000000000000000000900463ffffffff1681565b620001ed620005fb366004620036ce565b620016d3565b3480156200060e57600080fd5b50606854620002149065010000000000900473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200064657600080fd5b50620001ed62001c37565b3480156200065e57600080fd5b50620002b36200067036600462003600565b60696020526000908152604090205481565b3480156200068f57600080fd5b50620001c0620006a136600462003770565b62001c93565b606c5473ffffffffffffffffffffffffffffffffffffffff163314620006f9576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362001d7c565b565b6040805160e084901b7fffffffff0000000000000000000000000000000000000000000000000000000016602080830191909152606084901b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602483015282516018818403018152603890920183528151918101919091206000908152606a909152205473ffffffffffffffffffffffffffffffffffffffff165b92915050565b60685460ff1615620007e6576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff8681166101009092041614806200080c5750600263ffffffff861610155b1562000844576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b6001606860019054906101000a900463ffffffff163388883488886053546040516200089a9998979695949392919062003806565b60405180910390a1620009b8620009b26001606860019054906101000a900463ffffffff16338989348989604051620008d592919062003881565b60405180910390206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b62001e10565b8215620009c957620009c962001f27565b5050505050565b60685460ff161562000a0e576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000a258b8b8b8b8b8b8b8b8b8b8b600062001ffc565b73ffffffffffffffffffffffffffffffffffffffff861662000b01576040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff861690859060405162000a7a9190620038e6565b60006040518083038185875af1925050503d806000811462000ab9576040519150601f19603f3d011682016040523d82523d6000602084013e62000abe565b606091505b505090508062000afa576040517f6747a28800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5062000efc565b60685463ffffffff61010090910481169088160362000b435762000b3d73ffffffffffffffffffffffffffffffffffffffff87168585620021ed565b62000efc565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b166024820152600090603801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000818152606a90935291205490915073ffffffffffffffffffffffffffffffffffffffff168062000e6e576000808062000c1886880188620039fb565b92509250925060008584848460405162000c329062003292565b62000c409392919062003abd565b8190604051809103906000f590508015801562000c61573d6000803e3d6000fd5b506040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c81166004830152602482018c9052919250908216906340c10f1990604401600060405180830381600087803b15801562000cd757600080fd5b505af115801562000cec573d6000803e3d6000fd5b5050505080606a600088815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060405180604001604052808e63ffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff16815250606b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050507f490e59a1701b938786ac72570a1efeac994a3dbe96e2e883e19e902ace6e6a398d8d838b8b60405162000e5c95949392919062003afa565b60405180910390a15050505062000ef9565b6040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018790528216906340c10f1990604401600060405180830381600087803b15801562000edf57600080fd5b505af115801562000ef4573d6000803e3d6000fd5b505050505b50505b6040805163ffffffff8c811682528916602082015273ffffffffffffffffffffffffffffffffffffffff88811682840152861660608201526080810185905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a15050505050505050505050565b60685460ff161562000fb2576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000fc98b8b8b8b8b8b8b8b8b8b8b600162001ffc565b60008473ffffffffffffffffffffffffffffffffffffffff1684888a868660405160240162000ffc949392919062003b42565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1806b5f200000000000000000000000000000000000000000000000000000000179052516200107f9190620038e6565b60006040518083038185875af1925050503d8060008114620010be576040519150601f19603f3d011682016040523d82523d6000602084013e620010c3565b606091505b5050905080620010ff576040517f37e391c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805163ffffffff8d811682528a16602082015273ffffffffffffffffffffffffffffffffffffffff89811682840152871660608201526080810186905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a1505050505050505050505050565b605354600090819081805b602081101562001255578083901c600116600103620011e65760338160208110620011b257620011b262003b8a565b0154604080516020810192909252810185905260600160405160208183030381529060405280519060200120935062001213565b60408051602081018690529081018390526060016040516020818303038152906040528051906020012093505b604080516020810184905290810183905260600160405160208183030381529060405280519060200120915080806200124c9062003be8565b91505062001183565b50919392505050565b600054610100900460ff16158080156200127f5750600054600160ff909116105b806200129b5750303b1580156200129b575060005460ff166001145b6200132d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156200138c57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b606880547fffffffffffffff000000000000000000000000000000000000000000000000ff1661010063ffffffff8716027fffffffffffffff0000000000000000000000000000000000000000ffffffffff16176501000000000073ffffffffffffffffffffffffffffffffffffffff8681169190910291909117909155606c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001691841691909117905562001443620022c3565b8015620014a757600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b605354606854790100000000000000000000000000000000000000000000000000900463ffffffff16101562000703576200070362001f27565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b1660248201526000908190603801604051602081830303815290604052805190602001209050600060ff60f81b3083604051806020016200157d9062003292565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082820381018352601f909101166040819052620015c8908d908d908d908d908d9060200162003c23565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905262001606929160200162003c64565b604051602081830303815290604052805190602001206040516020016200168f94939291907fff0000000000000000000000000000000000000000000000000000000000000094909416845260609290921b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660018401526015830152603582015260550190565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815291905280516020909101209a9950505050505050505050565b60685460ff161562001711576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200171b62002366565b60685463ffffffff888116610100909204161480620017415750600263ffffffff881610155b1562001779576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060608773ffffffffffffffffffffffffffffffffffffffff8816620017df57883414620017d5576040517fb89240f500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000925062001ad9565b341562001818576040517f798ee6f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8089166000908152606b602090815260409182902082518084019093525463ffffffff811683526401000000009004909216918101829052901562001908576040517f9dc29fac000000000000000000000000000000000000000000000000000000008152336004820152602481018b905273ffffffffffffffffffffffffffffffffffffffff8a1690639dc29fac90604401600060405180830381600087803b158015620018db57600080fd5b505af1158015620018f0573d6000803e3d6000fd5b50505050806020015194508060000151935062001ad7565b85156200191d576200191d898b8989620023db565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8b16906370a0823190602401602060405180830381865afa1580156200198b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620019b1919062003c97565b9050620019d773ffffffffffffffffffffffffffffffffffffffff8b1633308e620028f9565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa15801562001a45573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001a6b919062003c97565b905062001a79828262003cb1565b6068548c9850610100900463ffffffff169650935062001a998762002959565b62001aa48c62002a71565b62001aaf8d62002b7e565b60405160200162001ac39392919062003abd565b604051602081830303815290604052945050505b505b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b600084868e8e868860535460405162001b1b98979695949392919062003cc7565b60405180910390a162001c0f620009b2600085878f8f8789805190602001206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b861562001c205762001c2062001f27565b5050505062001c2e60018055565b50505050505050565b606c5473ffffffffffffffffffffffffffffffffffffffff16331462001c89576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362002c80565b600084815b602081101562001d6e57600163ffffffff8616821c8116900362001d0a5785816020811062001ccb5762001ccb62003b8a565b60200201358260405160200162001cec929190918252602082015260400190565b60405160208183030381529060405280519060200120915062001d59565b8186826020811062001d205762001d2062003b8a565b602002013560405160200162001d40929190918252602082015260400190565b6040516020818303038152906040528051906020012091505b8062001d658162003be8565b91505062001c98565b50821490505b949350505050565b60685460ff161562001dba576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556040517f2261efe5aef6fedc1fd1550b25facc9181745623049c7901287030b9ad1a549790600090a1565b80600162001e216020600262003e79565b62001e2d919062003cb1565b6053541062001e68576040517fef5ccf6600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060536000815462001e7b9062003be8565b9182905550905060005b602081101562001f17578082901c60011660010362001ebd57826033826020811062001eb55762001eb562003b8a565b015550505050565b6033816020811062001ed35762001ed362003b8a565b01546040805160208101929092528101849052606001604051602081830303815290604052805190602001209250808062001f0e9062003be8565b91505062001e85565b5062001f2262003e87565b505050565b6053546068805463ffffffff909216790100000000000000000000000000000000000000000000000000027fffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffff909216919091179081905573ffffffffffffffffffffffffffffffffffffffff65010000000000909104166333d6247d62001fad62001178565b6040518263ffffffff1660e01b815260040162001fcc91815260200190565b600060405180830381600087803b15801562001fe757600080fd5b505af1158015620014a7573d6000803e3d6000fd5b6200200d8b63ffffffff1662002d10565b6068546040805160208082018e90528183018d9052825180830384018152606083019384905280519101207f257b363200000000000000000000000000000000000000000000000000000000909252606481019190915260009165010000000000900473ffffffffffffffffffffffffffffffffffffffff169063257b3632906084016020604051808303816000875af1158015620020b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620020d6919062003c97565b90508060000362002112576040517e2f6fad00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff88811661010090920416146200215c576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606854600090610100900463ffffffff166200217a5750896200217d565b508a5b620021a66200219d848c8c8c8c8c8c8c604051620008d592919062003881565b8f8f8462001c93565b620021dd576040517fe0417cec00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905262001f229084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262002d75565b600054610100900460ff166200235c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6200070362002e88565b600260015403620023d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640162001324565b6002600155565b6000620023ec600482848662003eb6565b620023f79162003ee2565b90507f2afa5331000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000821601620026765760008080808080806200245a896004818d62003eb6565b81019062002469919062003f2b565b96509650965096509650965096503373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614620024dd576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff861630146200252d576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8a851462002567576040517f03fffc4b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff89811660248301528881166044830152606482018890526084820187905260ff861660a483015260c4820185905260e48083018590528351808403909101815261010490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fd505accf000000000000000000000000000000000000000000000000000000001790529151918e1691620026229190620038e6565b6000604051808303816000865af19150503d806000811462002661576040519150601f19603f3d011682016040523d82523d6000602084013e62002666565b606091505b50505050505050505050620009c9565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f8fcbaf0c0000000000000000000000000000000000000000000000000000000014620026f2576040517fe282c0ba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080808080806200270a8a6004818e62003eb6565b81019062002719919062003f86565b975097509750975097509750975097503373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16146200278f576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff87163014620027df576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8a811660248301528981166044830152606482018990526084820188905286151560a483015260ff861660c483015260e482018590526101048083018590528351808403909101815261012490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f8fcbaf0c000000000000000000000000000000000000000000000000000000001790529151918f1691620028a39190620038e6565b6000604051808303816000865af19150503d8060008114620028e2576040519150601f19603f3d011682016040523d82523d6000602084013e620028e7565b606091505b50505050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052620014a79085907f23b872dd000000000000000000000000000000000000000000000000000000009060840162002240565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f06fdde03000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff861691620029dd9190620038e6565b600060405180830381855afa9150503d806000811462002a1a576040519150601f19603f3d011682016040523d82523d6000602084013e62002a1f565b606091505b50915091508162002a66576040518060400160405280600781526020017f4e4f5f4e414d450000000000000000000000000000000000000000000000000081525062001d74565b62001d748162002f21565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f95d89b41000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff86169162002af59190620038e6565b600060405180830381855afa9150503d806000811462002b32576040519150601f19603f3d011682016040523d82523d6000602084013e62002b37565b606091505b50915091508162002a66576040518060400160405280600981526020017f4e4f5f53594d424f4c000000000000000000000000000000000000000000000081525062001d74565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f313ce5670000000000000000000000000000000000000000000000000000000017905290516000918291829173ffffffffffffffffffffffffffffffffffffffff86169162002c019190620038e6565b600060405180830381855afa9150503d806000811462002c3e576040519150601f19603f3d011682016040523d82523d6000602084013e62002c43565b606091505b509150915081801562002c57575080516020145b62002c6457601262001d74565b8080602001905181019062001d74919062004012565b60018055565b60685460ff1662002cbd576040517f5386698100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040517f1e5e34eea33501aecf2ebec9fe0e884a40804275ea7fe10b2ba084c8374308b390600090a1565b600881901c60008181526069602052604081208054600160ff861690811b91821892839055929091908183169003620009c9576040517f646cf55800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600062002dd9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16620031119092919063ffffffff16565b80519091501562001f22578080602001905181019062002dfa919062004032565b62001f22576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840162001324565b600054610100900460ff1662002c7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6060604082511062002f435781806020019051810190620007a2919062004052565b8151602003620030d35760005b60208110801562002f9b575082818151811062002f715762002f7162003b8a565b01602001517fff000000000000000000000000000000000000000000000000000000000000001615155b1562002fb6578062002fad8162003be8565b91505062002f50565b8060000362002ffa57505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e4700000000000000000000000000006020820152919050565b60008167ffffffffffffffff81111562003018576200301862003891565b6040519080825280601f01601f19166020018201604052801562003043576020820181803683370190505b50905060005b82811015620030cb5784818151811062003067576200306762003b8a565b602001015160f81c60f81b82828151811062003087576200308762003b8a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080620030c28162003be8565b91505062003049565b509392505050565b505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e470000000000000000000000000000602082015290565b919050565b606062001d748484600085856000808673ffffffffffffffffffffffffffffffffffffffff168587604051620031489190620038e6565b60006040518083038185875af1925050503d806000811462003187576040519150601f19603f3d011682016040523d82523d6000602084013e6200318c565b606091505b50915091506200319f87838387620031aa565b979650505050505050565b60608315620032455782516000036200323d5773ffffffffffffffffffffffffffffffffffffffff85163b6200323d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162001324565b508162001d74565b62001d7483838151156200325c5781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620013249190620040d2565b611b6680620040e883390190565b803563ffffffff811681146200310c57600080fd5b73ffffffffffffffffffffffffffffffffffffffff81168114620032d857600080fd5b50565b60008060408385031215620032ef57600080fd5b620032fa83620032a0565b915060208301356200330c81620032b5565b809150509250929050565b8015158114620032d857600080fd5b60008083601f8401126200333957600080fd5b50813567ffffffffffffffff8111156200335257600080fd5b6020830191508360208285010111156200336b57600080fd5b9250929050565b6000806000806000608086880312156200338b57600080fd5b6200339686620032a0565b94506020860135620033a881620032b5565b93506040860135620033ba8162003317565b9250606086013567ffffffffffffffff811115620033d757600080fd5b620033e58882890162003326565b969995985093965092949392505050565b806104008101831015620007a257600080fd5b60008060008060008060008060008060006105208c8e0312156200342c57600080fd5b620034388d8d620033f6565b9a50620034496104008d01620032a0565b99506104208c013598506104408c013597506200346a6104608d01620032a0565b96506104808c01356200347d81620032b5565b95506200348e6104a08d01620032a0565b94506104c08c0135620034a181620032b5565b93506104e08c013592506105008c013567ffffffffffffffff811115620034c757600080fd5b620034d58e828f0162003326565b915080935050809150509295989b509295989b9093969950565b6000602082840312156200350257600080fd5b81356200350f81620032b5565b9392505050565b60ff81168114620032d857600080fd5b600080600080600080600060e0888a0312156200354257600080fd5b87356200354f8162003516565b96506200355f60208901620032a0565b955060408801356200357181620032b5565b94506200358160608901620032a0565b935060808801356200359381620032b5565b9699959850939692959460a0840135945060c09093013592915050565b600080600060608486031215620035c657600080fd5b620035d184620032a0565b92506020840135620035e381620032b5565b91506040840135620035f581620032b5565b809150509250925092565b6000602082840312156200361357600080fd5b5035919050565b600080600080600080600060a0888a0312156200363657600080fd5b6200364188620032a0565b965060208801356200365381620032b5565b9550604088013567ffffffffffffffff808211156200367157600080fd5b6200367f8b838c0162003326565b909750955060608a01359150808211156200369957600080fd5b50620036a88a828b0162003326565b9094509250506080880135620036be8162003516565b8091505092959891949750929550565b600080600080600080600060c0888a031215620036ea57600080fd5b620036f588620032a0565b965060208801356200370781620032b5565b95506040880135945060608801356200372081620032b5565b93506080880135620037328162003317565b925060a088013567ffffffffffffffff8111156200374f57600080fd5b6200375d8a828b0162003326565b989b979a50959850939692959293505050565b60008060008061046085870312156200378857600080fd5b843593506200379b8660208701620033f6565b9250620037ac6104208601620032a0565b939692955092936104400135925050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b600061010060ff8c16835263ffffffff808c16602085015273ffffffffffffffffffffffffffffffffffffffff808c166040860152818b166060860152808a166080860152508760a08501528160c0850152620038678285018789620037bd565b925080851660e085015250509a9950505050505050505050565b8183823760009101908152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60005b83811015620038dd578181015183820152602001620038c3565b50506000910152565b60008251620038fa818460208701620038c0565b9190910192915050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156200394e576200394e62003891565b604052919050565b600067ffffffffffffffff82111562003973576200397362003891565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112620039b157600080fd5b8135620039c8620039c28262003956565b62003904565b818152846020838601011115620039de57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121562003a1157600080fd5b833567ffffffffffffffff8082111562003a2a57600080fd5b62003a38878388016200399f565b9450602086013591508082111562003a4f57600080fd5b5062003a5e868287016200399f565b9250506040840135620035f58162003516565b6000815180845262003a8b816020860160208601620038c0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60608152600062003ad2606083018662003a71565b828103602084015262003ae6818662003a71565b91505060ff83166040830152949350505050565b63ffffffff86168152600073ffffffffffffffffffffffffffffffffffffffff8087166020840152808616604084015250608060608301526200319f608083018486620037bd565b73ffffffffffffffffffffffffffffffffffffffff8516815263ffffffff8416602082015260606040820152600062003b80606083018486620037bd565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820362003c1c5762003c1c62003bb9565b5060010190565b60608152600062003c39606083018789620037bd565b828103602084015262003c4e818688620037bd565b91505060ff831660408301529695505050505050565b6000835162003c78818460208801620038c0565b83519083019062003c8e818360208801620038c0565b01949350505050565b60006020828403121562003caa57600080fd5b5051919050565b81810381811115620007a257620007a262003bb9565b600061010060ff8b16835263ffffffff808b16602085015273ffffffffffffffffffffffffffffffffffffffff808b166040860152818a1660608601528089166080860152508660a08501528160c085015262003d278285018762003a71565b925080851660e085015250509998505050505050505050565b600181815b8085111562003d9f57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003d835762003d8362003bb9565b8085161562003d9157918102915b93841c939080029062003d45565b509250929050565b60008262003db857506001620007a2565b8162003dc757506000620007a2565b816001811462003de0576002811462003deb5762003e0b565b6001915050620007a2565b60ff84111562003dff5762003dff62003bb9565b50506001821b620007a2565b5060208310610133831016604e8410600b841016171562003e30575081810a620007a2565b62003e3c838362003d40565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003e715762003e7162003bb9565b029392505050565b60006200350f838362003da7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b6000808585111562003ec757600080fd5b8386111562003ed557600080fd5b5050820193919092039150565b7fffffffff00000000000000000000000000000000000000000000000000000000813581811691600485101562003f235780818660040360031b1b83161692505b505092915050565b600080600080600080600060e0888a03121562003f4757600080fd5b873562003f5481620032b5565b9650602088013562003f6681620032b5565b955060408801359450606088013593506080880135620035938162003516565b600080600080600080600080610100898b03121562003fa457600080fd5b883562003fb181620032b5565b9750602089013562003fc381620032b5565b96506040890135955060608901359450608089013562003fe38162003317565b935060a089013562003ff58162003516565b979a969950949793969295929450505060c08201359160e0013590565b6000602082840312156200402557600080fd5b81516200350f8162003516565b6000602082840312156200404557600080fd5b81516200350f8162003317565b6000602082840312156200406557600080fd5b815167ffffffffffffffff8111156200407d57600080fd5b8201601f810184136200408f57600080fd5b8051620040a0620039c28262003956565b818152856020838501011115620040b657600080fd5b620040c9826020830160208601620038c0565b95945050505050565b6020815260006200350f602083018462003a7156fe6101006040523480156200001257600080fd5b5060405162001b6638038062001b6683398101604081905262000035916200028d565b82826003620000458382620003a1565b506004620000548282620003a1565b50503360c0525060ff811660e052466080819052620000739062000080565b60a052506200046d915050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620000ad6200012e565b805160209182012060408051808201825260018152603160f81b90840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b6060600380546200013f9062000312565b80601f01602080910402602001604051908101604052809291908181526020018280546200016d9062000312565b8015620001be5780601f106200019257610100808354040283529160200191620001be565b820191906000526020600020905b815481529060010190602001808311620001a057829003601f168201915b5050505050905090565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001f057600080fd5b81516001600160401b03808211156200020d576200020d620001c8565b604051601f8301601f19908116603f01168101908282118183101715620002385762000238620001c8565b816040528381526020925086838588010111156200025557600080fd5b600091505b838210156200027957858201830151818301840152908201906200025a565b600093810190920192909252949350505050565b600080600060608486031215620002a357600080fd5b83516001600160401b0380821115620002bb57600080fd5b620002c987838801620001de565b94506020860151915080821115620002e057600080fd5b50620002ef86828701620001de565b925050604084015160ff811681146200030757600080fd5b809150509250925092565b600181811c908216806200032757607f821691505b6020821081036200034857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200039c57600081815260208120601f850160051c81016020861015620003775750805b601f850160051c820191505b81811015620003985782815560010162000383565b5050505b505050565b81516001600160401b03811115620003bd57620003bd620001c8565b620003d581620003ce845462000312565b846200034e565b602080601f8311600181146200040d5760008415620003f45750858301515b600019600386901b1c1916600185901b17855562000398565b600085815260208120601f198616915b828110156200043e578886015182559484019460019091019084016200041d565b50858210156200045d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e0516116aa620004bc6000396000610237015260008181610307015281816105c001526106a70152600061053a015260008181610379015261050401526116aa6000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806370a08231116100d8578063a457c2d71161008c578063d505accf11610066578063d505accf1461039b578063dd62ed3e146103ae578063ffa1ad74146103f457600080fd5b8063a457c2d71461034e578063a9059cbb14610361578063cd0d00961461037457600080fd5b806395d89b41116100bd57806395d89b41146102e75780639dc29fac146102ef578063a3c573eb1461030257600080fd5b806370a08231146102915780637ecebe00146102c757600080fd5b806330adf81f1161012f5780633644e515116101145780633644e51514610261578063395093511461026957806340c10f191461027c57600080fd5b806330adf81f14610209578063313ce5671461023057600080fd5b806318160ddd1161016057806318160ddd146101bd57806320606b70146101cf57806323b872dd146101f657600080fd5b806306fdde031461017c578063095ea7b31461019a575b600080fd5b610184610430565b60405161019191906113e4565b60405180910390f35b6101ad6101a8366004611479565b6104c2565b6040519015158152602001610191565b6002545b604051908152602001610191565b6101c17f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b6101ad6102043660046114a3565b6104dc565b6101c17f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610191565b6101c1610500565b6101ad610277366004611479565b61055c565b61028f61028a366004611479565b6105a8565b005b6101c161029f3660046114df565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6101c16102d53660046114df565b60056020526000908152604090205481565b610184610680565b61028f6102fd366004611479565b61068f565b6103297f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610191565b6101ad61035c366004611479565b61075e565b6101ad61036f366004611479565b61082f565b6101c17f000000000000000000000000000000000000000000000000000000000000000081565b61028f6103a9366004611501565b61083d565b6101c16103bc366004611574565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6101846040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b60606003805461043f906115a7565b80601f016020809104026020016040519081016040528092919081815260200182805461046b906115a7565b80156104b85780601f1061048d576101008083540402835291602001916104b8565b820191906000526020600020905b81548152906001019060200180831161049b57829003601f168201915b5050505050905090565b6000336104d0818585610b73565b60019150505b92915050565b6000336104ea858285610d27565b6104f5858585610dfe565b506001949350505050565b60007f00000000000000000000000000000000000000000000000000000000000000004614610537576105324661106d565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906104d090829086906105a3908790611629565b610b73565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610672576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d4272696467650000000000000000000000000000000060648201526084015b60405180910390fd5b61067c8282611135565b5050565b60606004805461043f906115a7565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610754576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d427269646765000000000000000000000000000000006064820152608401610669565b61067c8282611228565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610669565b6104f58286868403610b73565b6000336104d0818585610dfe565b834211156108cc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f546f6b656e577261707065643a3a7065726d69743a204578706972656420706560448201527f726d6974000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260056020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a9190866109268361163c565b9091555060408051602081019690965273ffffffffffffffffffffffffffffffffffffffff94851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610991610500565b6040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281019190915260428101839052606201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015610a55573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590610ad057508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610b5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f546f6b656e577261707065643a3a7065726d69743a20496e76616c696420736960448201527f676e6174757265000000000000000000000000000000000000000000000000006064820152608401610669565b610b678a8a8a610b73565b50505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8316610c15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610cb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610df85781811015610deb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610669565b610df88484848403610b73565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610ea1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610f44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610ffa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610df8565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611098610430565b8051602091820120604080518082018252600181527f310000000000000000000000000000000000000000000000000000000000000090840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b73ffffffffffffffffffffffffffffffffffffffff82166111b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610669565b80600260008282546111c49190611629565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff82166112cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015611381576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610d1a565b600060208083528351808285015260005b81811015611411578581018301518582016040015282016113f5565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461147457600080fd5b919050565b6000806040838503121561148c57600080fd5b61149583611450565b946020939093013593505050565b6000806000606084860312156114b857600080fd5b6114c184611450565b92506114cf60208501611450565b9150604084013590509250925092565b6000602082840312156114f157600080fd5b6114fa82611450565b9392505050565b600080600080600080600060e0888a03121561151c57600080fd5b61152588611450565b965061153360208901611450565b95506040880135945060608801359350608088013560ff8116811461155757600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561158757600080fd5b61159083611450565b915061159e60208401611450565b90509250929050565b600181811c908216806115bb57607f821691505b6020821081036115f4577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156104d6576104d66115fa565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361166d5761166d6115fa565b506001019056fea26469706673582212208d88fee561cff7120d381c345cfc534cef8229a272dc5809d4bbb685ad67141164736f6c63430008110033a2646970667358221220d9b3ca7b13ec80ac58634ddf0ecebe71e209a71f532614949b9e720413f50c8364736f6c63430008110033"
42
- },
43
- {
44
- "contractName": "PolygonZkEVMBridge proxy",
45
- "balance": "200000000000000000000000000",
46
- "nonce": "1",
47
- "address": "0x2a3DD3EB832aF982ec71669E178424b10Dca2EDe",
48
- "bytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461088b565b610135565b61006b6100a33660046108a6565b61017f565b3480156100b457600080fd5b506100bd6101f3565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461088b565b610231565b34801561011257600080fd5b506100bd61025e565b6101236102d4565b61013361012e6103ab565b6103b5565b565b61013d6103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481604051806020016040528060008152506000610419565b50565b61017461011b565b6101876103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101eb576101e68383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610419915050565b505050565b6101e661011b565b60006101fd6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103ab565b905090565b61022e61011b565b90565b6102396103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481610444565b60006102686103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103d9565b60606102b183836040518060600160405280602781526020016109bb602791396104a5565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6102dc6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b600061022161052a565b3660008037600080366000845af43d6000803e8080156103d4573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b61042283610552565b60008251118061042f5750805b156101e65761043e838361028c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61046d6103d9565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a16101748161059f565b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516104cf919061094d565b600060405180830381855af49150503d806000811461050a576040519150601f19603f3d011682016040523d82523d6000602084013e61050f565b606091505b5091509150610520868383876106ab565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103fd565b61055b81610753565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff8116610642576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103a2565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b6060831561074157825160000361073a5773ffffffffffffffffffffffffffffffffffffffff85163b61073a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103a2565b508161074b565b61074b838361081e565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff81163b6107f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016103a2565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610665565b81511561082e5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a29190610969565b803573ffffffffffffffffffffffffffffffffffffffff8116811461088657600080fd5b919050565b60006020828403121561089d57600080fd5b6102b182610862565b6000806000604084860312156108bb57600080fd5b6108c484610862565b9250602084013567ffffffffffffffff808211156108e157600080fd5b818601915086601f8301126108f557600080fd5b81358181111561090457600080fd5b87602082850101111561091657600080fd5b6020830194508093505050509250925092565b60005b8381101561094457818101518382015260200161092c565b50506000910152565b6000825161095f818460208701610929565b9190910192915050565b6020815260008251806020840152610988816040850160208701610929565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220a1af0d6cb4f1e31496a4c5c1448913bce4bd6ad3a39e47c6f7190c114d6f9bf464736f6c63430008110033",
49
- "storage": {
50
- "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000000000000000000000000000000000000000001",
51
- "0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000000001",
52
- "0x0000000000000000000000000000000000000000000000000000000000000068": "0x00000000000000a40d5f56745a118d0906a34e69aec8c0db1cb8fa0000000100",
53
- "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x0000000000000000000000000f99738b2fc14d77308337f3e2596b63ae7bcc4a",
54
- "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x0000000000000000000000005ac4182a1dd41aeef465e40b82fd326bf66ab82c"
55
- }
56
- },
57
- {
58
- "contractName": "PolygonZkEVMGlobalExitRootL2 implementation",
59
- "balance": "0",
60
- "nonce": "1",
61
- "address": "0x0200143Fa295EE4dffEF22eE2616c2E008D81688",
62
- "bytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806301fd904414610051578063257b36321461006d57806333d6247d1461008d578063a3c573eb146100a2575b600080fd5b61005a60015481565b6040519081526020015b60405180910390f35b61005a61007b366004610162565b60006020819052908152604090205481565b6100a061009b366004610162565b6100ee565b005b6100c97f0000000000000000000000002a3dd3eb832af982ec71669e178424b10dca2ede81565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610064565b3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000002a3dd3eb832af982ec71669e178424b10dca2ede161461015d576040517fb49365dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600155565b60006020828403121561017457600080fd5b503591905056fea2646970667358221220a187fc278346c1b61c449ea3641002b6eac2bda3351a122a12c35099f933696864736f6c63430008110033"
63
- },
64
- {
65
- "contractName": "PolygonZkEVMGlobalExitRootL2 proxy",
66
- "balance": "0",
67
- "nonce": "1",
68
- "address": "0xa40d5f56745a118d0906a34e69aec8c0db1cb8fa",
69
- "bytecode": "0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100855780635c60da1b146100985780638f283970146100c9578063f851a440146100e95761005d565b3661005d5761005b6100fe565b005b61005b6100fe565b34801561007157600080fd5b5061005b6100803660046106ca565b610118565b61005b6100933660046106e5565b61015f565b3480156100a457600080fd5b506100ad6101d0565b6040516001600160a01b03909116815260200160405180910390f35b3480156100d557600080fd5b5061005b6100e43660046106ca565b61020b565b3480156100f557600080fd5b506100ad610235565b610106610292565b610116610111610331565b61033b565b565b61012061035f565b6001600160a01b0316336001600160a01b031614156101575761015481604051806020016040528060008152506000610392565b50565b6101546100fe565b61016761035f565b6001600160a01b0316336001600160a01b031614156101c8576101c38383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610392915050565b505050565b6101c36100fe565b60006101da61035f565b6001600160a01b0316336001600160a01b03161415610200576101fb610331565b905090565b6102086100fe565b90565b61021361035f565b6001600160a01b0316336001600160a01b0316141561015757610154816103f1565b600061023f61035f565b6001600160a01b0316336001600160a01b03161415610200576101fb61035f565b606061028583836040518060600160405280602781526020016107e460279139610445565b9392505050565b3b151590565b61029a61035f565b6001600160a01b0316336001600160a01b031614156101165760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b60006101fb610519565b3660008037600080366000845af43d6000803e80801561035a573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b61039b83610541565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806103dc5750805b156101c3576103eb8383610260565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61041a61035f565b604080516001600160a01b03928316815291841660208301520160405180910390a1610154816105e9565b6060833b6104a45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610328565b600080856001600160a01b0316856040516104bf9190610794565b600060405180830381855af49150503d80600081146104fa576040519150601f19603f3d011682016040523d82523d6000602084013e6104ff565b606091505b509150915061050f828286610675565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610383565b803b6105a55760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610328565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b80546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b03811661064e5760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610328565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036105c8565b60608315610684575081610285565b8251156106945782518084602001fd5b8160405162461bcd60e51b815260040161032891906107b0565b80356001600160a01b03811681146106c557600080fd5b919050565b6000602082840312156106dc57600080fd5b610285826106ae565b6000806000604084860312156106fa57600080fd5b610703846106ae565b9250602084013567ffffffffffffffff8082111561072057600080fd5b818601915086601f83011261073457600080fd5b81358181111561074357600080fd5b87602082850101111561075557600080fd5b6020830194508093505050509250925092565b60005b8381101561078357818101518382015260200161076b565b838111156103eb5750506000910152565b600082516107a6818460208701610768565b9190910192915050565b60208152600082518060208401526107cf816040850160208701610768565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212204675187caf3a43285d9a2c1844a981e977bd52a85ff073e7fc649f73847d70a464736f6c63430008090033",
70
- "storage": {
71
- "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x0000000000000000000000000f99738b2fc14d77308337f3e2596b63ae7bcc4a",
72
- "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x0000000000000000000000000200143fa295ee4dffef22ee2616c2e008d81688"
73
- }
74
- },
75
- {
76
- "contractName": "PolygonZkEVMTimelock",
77
- "balance": "0",
78
- "nonce": "1",
79
- "address": "0xBBa0935Fa93Eb23de7990b47F0D96a8f75766d13",
80
- "bytecode": "0x6080604052600436106101c65760003560e01c806364d62353116100f7578063b1c5f42711610095578063d547741f11610064578063d547741f14610661578063e38335e514610681578063f23a6e6114610694578063f27a0c92146106d957600080fd5b8063b1c5f427146105af578063bc197c81146105cf578063c4d252f514610614578063d45c44351461063457600080fd5b80638f61f4f5116100d15780638f61f4f5146104e157806391d1485414610515578063a217fddf14610566578063b08e51c01461057b57600080fd5b806364d62353146104815780638065657f146104a15780638f2a0bb0146104c157600080fd5b8063248a9ca31161016457806331d507501161013e57806331d50750146103c857806336568abe146103e85780633a6aae7214610408578063584b153e1461046157600080fd5b8063248a9ca3146103475780632ab0f529146103775780632f2ff15d146103a857600080fd5b80630d3cf6fc116101a05780630d3cf6fc1461026b578063134008d31461029f57806313bc9f20146102b2578063150b7a02146102d257600080fd5b806301d5062a146101d257806301ffc9a7146101f457806307bd02651461022957600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed366004611c52565b6106ee565b005b34801561020057600080fd5b5061021461020f366004611cc7565b610783565b60405190151581526020015b60405180910390f35b34801561023557600080fd5b5061025d7fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e6381565b604051908152602001610220565b34801561027757600080fd5b5061025d7f5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca581565b6101f26102ad366004611d09565b6107df565b3480156102be57600080fd5b506102146102cd366004611d75565b6108d7565b3480156102de57600080fd5b506103166102ed366004611e9a565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610220565b34801561035357600080fd5b5061025d610362366004611d75565b60009081526020819052604090206001015490565b34801561038357600080fd5b50610214610392366004611d75565b6000908152600160208190526040909120541490565b3480156103b457600080fd5b506101f26103c3366004611f02565b6108fd565b3480156103d457600080fd5b506102146103e3366004611d75565b610927565b3480156103f457600080fd5b506101f2610403366004611f02565b610940565b34801561041457600080fd5b5061043c7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610220565b34801561046d57600080fd5b5061021461047c366004611d75565b6109f8565b34801561048d57600080fd5b506101f261049c366004611d75565b610a0e565b3480156104ad57600080fd5b5061025d6104bc366004611d09565b610ade565b3480156104cd57600080fd5b506101f26104dc366004611f73565b610b1d565b3480156104ed57600080fd5b5061025d7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc181565b34801561052157600080fd5b50610214610530366004611f02565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b34801561057257600080fd5b5061025d600081565b34801561058757600080fd5b5061025d7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f78381565b3480156105bb57600080fd5b5061025d6105ca366004612025565b610d4f565b3480156105db57600080fd5b506103166105ea36600461214e565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b34801561062057600080fd5b506101f261062f366004611d75565b610d94565b34801561064057600080fd5b5061025d61064f366004611d75565b60009081526001602052604090205490565b34801561066d57600080fd5b506101f261067c366004611f02565b610e8f565b6101f261068f366004612025565b610eb4565b3480156106a057600080fd5b506103166106af3660046121f8565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b3480156106e557600080fd5b5061025d611161565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc161071881611244565b6000610728898989898989610ade565b90506107348184611251565b6000817f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8b8b8b8b8b8a604051610770969594939291906122a6565b60405180910390a3505050505050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e00000000000000000000000000000000000000000000000000000000014806107d957506107d98261139e565b92915050565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff1661085c5761085c8133611435565b600061086c888888888888610ade565b905061087881856114ed565b6108848888888861162a565b6000817fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588a8a8a8a6040516108bc94939291906122f1565b60405180910390a36108cd8161172e565b5050505050505050565b6000818152600160205260408120546001811180156108f65750428111155b9392505050565b60008281526020819052604090206001015461091881611244565b61092283836117d7565b505050565b60008181526001602052604081205481905b1192915050565b73ffffffffffffffffffffffffffffffffffffffff811633146109ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6109f482826118c7565b5050565b6000818152600160208190526040822054610939565b333014610a9d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f54696d656c6f636b436f6e74726f6c6c65723a2063616c6c6572206d7573742060448201527f62652074696d656c6f636b00000000000000000000000000000000000000000060648201526084016109e1565b60025460408051918252602082018390527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1600255565b6000868686868686604051602001610afb969594939291906122a6565b6040516020818303038152906040528051906020012090509695505050505050565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1610b4781611244565b888714610bd6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b888514610c65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b6000610c778b8b8b8b8b8b8b8b610d4f565b9050610c838184611251565b60005b8a811015610d415780827f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8e8e85818110610cc357610cc3612331565b9050602002016020810190610cd89190612360565b8d8d86818110610cea57610cea612331565b905060200201358c8c87818110610d0357610d03612331565b9050602002810190610d15919061237b565b8c8b604051610d29969594939291906122a6565b60405180910390a3610d3a8161240f565b9050610c86565b505050505050505050505050565b60008888888888888888604051602001610d709897969594939291906124f7565b60405160208183030381529060405280519060200120905098975050505050505050565b7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783610dbe81611244565b610dc7826109f8565b610e53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20636160448201527f6e6e6f742062652063616e63656c6c656400000000000000000000000000000060648201526084016109e1565b6000828152600160205260408082208290555183917fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb7091a25050565b600082815260208190526040902060010154610eaa81611244565b61092283836118c7565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff16610f3157610f318133611435565b878614610fc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b87841461104f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b60006110618a8a8a8a8a8a8a8a610d4f565b905061106d81856114ed565b60005b8981101561114b5760008b8b8381811061108c5761108c612331565b90506020020160208101906110a19190612360565b905060008a8a848181106110b7576110b7612331565b9050602002013590503660008a8a868181106110d5576110d5612331565b90506020028101906110e7919061237b565b915091506110f78484848461162a565b84867fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588686868660405161112e94939291906122f1565b60405180910390a350505050806111449061240f565b9050611070565b506111558161172e565b50505050505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff161580159061123257507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166315064c966040518163ffffffff1660e01b8152600401602060405180830381865afa15801561120e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123291906125be565b1561123d5750600090565b5060025490565b61124e8133611435565b50565b61125a82610927565b156112e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20616c60448201527f7265616479207363686564756c6564000000000000000000000000000000000060648201526084016109e1565b6112ef611161565b81101561137e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a20696e73756666696369656e7460448201527f2064656c6179000000000000000000000000000000000000000000000000000060648201526084016109e1565b61138881426125e0565b6000928352600160205260409092209190915550565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806107d957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107d9565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f4576114738161197e565b61147e83602061199d565b60405160200161148f929190612617565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526109e191600401612698565b6114f6826108d7565b611582576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b80158061159e5750600081815260016020819052604090912054145b6109f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a206d697373696e67206465706560448201527f6e64656e6379000000000000000000000000000000000000000000000000000060648201526084016109e1565b60008473ffffffffffffffffffffffffffffffffffffffff168484846040516116549291906126e9565b60006040518083038185875af1925050503d8060008114611691576040519150601f19603f3d011682016040523d82523d6000602084013e611696565b606091505b5050905080611727576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f54696d656c6f636b436f6e74726f6c6c65723a20756e6465726c79696e67207460448201527f72616e73616374696f6e2072657665727465640000000000000000000000000060648201526084016109e1565b5050505050565b611737816108d7565b6117c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b600090815260016020819052604090912055565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556118693390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606107d973ffffffffffffffffffffffffffffffffffffffff831660145b606060006119ac8360026126f9565b6119b79060026125e0565b67ffffffffffffffff8111156119cf576119cf611d8e565b6040519080825280601f01601f1916602001820160405280156119f9576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611a3057611a30612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611a9357611a93612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611acf8460026126f9565b611ada9060016125e0565b90505b6001811115611b77577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611b1b57611b1b612331565b1a60f81b828281518110611b3157611b31612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611b7081612710565b9050611add565b5083156108f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109e1565b803573ffffffffffffffffffffffffffffffffffffffff81168114611c0457600080fd5b919050565b60008083601f840112611c1b57600080fd5b50813567ffffffffffffffff811115611c3357600080fd5b602083019150836020828501011115611c4b57600080fd5b9250929050565b600080600080600080600060c0888a031215611c6d57600080fd5b611c7688611be0565b965060208801359550604088013567ffffffffffffffff811115611c9957600080fd5b611ca58a828b01611c09565b989b979a50986060810135976080820135975060a09091013595509350505050565b600060208284031215611cd957600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146108f657600080fd5b60008060008060008060a08789031215611d2257600080fd5b611d2b87611be0565b955060208701359450604087013567ffffffffffffffff811115611d4e57600080fd5b611d5a89828a01611c09565b979a9699509760608101359660809091013595509350505050565b600060208284031215611d8757600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611e0457611e04611d8e565b604052919050565b600082601f830112611e1d57600080fd5b813567ffffffffffffffff811115611e3757611e37611d8e565b611e6860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611dbd565b818152846020838601011115611e7d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215611eb057600080fd5b611eb985611be0565b9350611ec760208601611be0565b925060408501359150606085013567ffffffffffffffff811115611eea57600080fd5b611ef687828801611e0c565b91505092959194509250565b60008060408385031215611f1557600080fd5b82359150611f2560208401611be0565b90509250929050565b60008083601f840112611f4057600080fd5b50813567ffffffffffffffff811115611f5857600080fd5b6020830191508360208260051b8501011115611c4b57600080fd5b600080600080600080600080600060c08a8c031215611f9157600080fd5b893567ffffffffffffffff80821115611fa957600080fd5b611fb58d838e01611f2e565b909b50995060208c0135915080821115611fce57600080fd5b611fda8d838e01611f2e565b909950975060408c0135915080821115611ff357600080fd5b506120008c828d01611f2e565b9a9d999c50979a969997986060880135976080810135975060a0013595509350505050565b60008060008060008060008060a0898b03121561204157600080fd5b883567ffffffffffffffff8082111561205957600080fd5b6120658c838d01611f2e565b909a50985060208b013591508082111561207e57600080fd5b61208a8c838d01611f2e565b909850965060408b01359150808211156120a357600080fd5b506120b08b828c01611f2e565b999c989b509699959896976060870135966080013595509350505050565b600082601f8301126120df57600080fd5b8135602067ffffffffffffffff8211156120fb576120fb611d8e565b8160051b61210a828201611dbd565b928352848101820192828101908785111561212457600080fd5b83870192505b848310156121435782358252918301919083019061212a565b979650505050505050565b600080600080600060a0868803121561216657600080fd5b61216f86611be0565b945061217d60208701611be0565b9350604086013567ffffffffffffffff8082111561219a57600080fd5b6121a689838a016120ce565b945060608801359150808211156121bc57600080fd5b6121c889838a016120ce565b935060808801359150808211156121de57600080fd5b506121eb88828901611e0c565b9150509295509295909350565b600080600080600060a0868803121561221057600080fd5b61221986611be0565b945061222760208701611be0565b93506040860135925060608601359150608086013567ffffffffffffffff81111561225157600080fd5b6121eb88828901611e0c565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b73ffffffffffffffffffffffffffffffffffffffff8716815285602082015260a0604082015260006122dc60a08301868861225d565b60608301949094525060800152949350505050565b73ffffffffffffffffffffffffffffffffffffffff8516815283602082015260606040820152600061232760608301848661225d565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561237257600080fd5b6108f682611be0565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126123b057600080fd5b83018035915067ffffffffffffffff8211156123cb57600080fd5b602001915036819003821315611c4b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612440576124406123e0565b5060010190565b81835260006020808501808196508560051b810191508460005b878110156124ea57828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18836030181126124a057600080fd5b8701858101903567ffffffffffffffff8111156124bc57600080fd5b8036038213156124cb57600080fd5b6124d686828461225d565b9a87019a9550505090840190600101612461565b5091979650505050505050565b60a0808252810188905260008960c08301825b8b8110156125455773ffffffffffffffffffffffffffffffffffffffff61253084611be0565b1682526020928301929091019060010161250a565b5083810360208501528881527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff89111561257e57600080fd5b8860051b9150818a602083013701828103602090810160408501526125a69082018789612447565b60608401959095525050608001529695505050505050565b6000602082840312156125d057600080fd5b815180151581146108f657600080fd5b808201808211156107d9576107d96123e0565b60005b8381101561260e5781810151838201526020016125f6565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161264f8160178501602088016125f3565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161268c8160288401602088016125f3565b01602801949350505050565b60208152600082518060208401526126b78160408501602087016125f3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b8183823760009101908152919050565b80820281158282048414176107d9576107d96123e0565b60008161271f5761271f6123e0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea26469706673582212206416c4e08f97752b4bb06159524dac058d3dccd8775e57ef1b01505751ebf7af64736f6c63430008110033",
81
- "storage": {
82
- "0x0000000000000000000000000000000000000000000000000000000000000002": "0x00000000000000000000000000000000000000000000000000000000000d2f00",
83
- "0x33d4aa03df3f12c4f615b40676f67fdafecd3edb5a9c0ca2a47a923dae33a023": "0x0000000000000000000000000000000000000000000000000000000000000001",
84
- "0x9fa2d8034dbcb437bee38d61fbd100910e1342ffc07f128aa1b8e6790b7f3f68": "0x0000000000000000000000000000000000000000000000000000000000000001",
85
- "0x64494413541ff93b31aa309254e3fed72a7456e9845988b915b4c7a7ceba8814": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5",
86
- "0x531a7c25761aa4b0f2310edca9bb25e1e3ceb49ad4b0422aec866b3ce7567c87": "0x0000000000000000000000000000000000000000000000000000000000000001",
87
- "0x3412d5605ac6cd444957cedb533e5dacad6378b4bc819ebe3652188a665066d6": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5",
88
- "0xedbedc78c4240c7613622a35de050b48bd6c6d9a31b3d485b68fbbed54a4802d": "0x0000000000000000000000000000000000000000000000000000000000000001",
89
- "0xdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d706a": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5",
90
- "0x76616448da8d124a07383c26a6b2433b3259de946aa40f51524ec96ee05e871a": "0x0000000000000000000000000000000000000000000000000000000000000001",
91
- "0xc3ad33e20b0c56a223ad5104fff154aa010f8715b9c981fd38fdc60a4d1a52fc": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5"
92
- }
93
- },
94
- {
95
- "accountName": "keyless Deployer",
96
- "balance": "0",
97
- "nonce": "1",
98
- "address": "0x9d90066e7478496e2284E54c3548106bb4F90E50"
99
- },
100
- {
101
- "accountName": "deployer",
102
- "balance": "0",
103
- "nonce": "8",
104
- "address": "0x4c1665d6651ecEfa59B9B3041951608468b18891"
105
- }
106
- ]
107
- }
108
- `
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
{/home/stefan/go/src/Polygon/zkevm-node → .}/config/network.go RENAMED
@@ -25,17 +25,16 @@
25
 
26
  type network string
27
 
28
- const mainnet network = "mainnet"
29
- const testnet network = "testnet"
30
- const cardona network = "cardona"
31
  const custom network = "custom"
32
 
33
  // GenesisFromJSON is the config file for network_custom
34
  type GenesisFromJSON struct {
35
  // L1: root hash of the genesis block
36
  Root string `json:"root"`
37
- // L1: block number of the genesis block
38
- GenesisBlockNum uint64 `json:"genesisBlockNumber"`
 
 
39
  // L2: List of states contracts used to populate merkle tree at initial state
40
  Genesis []genesisAccountFromJSON `json:"genesis"`
41
  // L1: configuration of the network
@@ -60,12 +59,6 @@
60
  func (cfg *Config) loadNetworkConfig(ctx *cli.Context) {
61
  var networkJSON string
62
  switch ctx.String(FlagNetwork) {
63
- case string(mainnet):
64
- networkJSON = MainnetNetworkConfigJSON
65
- case string(testnet):
66
- networkJSON = TestnetNetworkConfigJSON
67
- case string(cardona):
68
- networkJSON = CardonaNetworkConfigJSON
69
  case string(custom):
70
  var err error
71
  cfgPath := ctx.String(FlagCustomNetwork)
@@ -74,7 +67,7 @@
74
  panic(err.Error())
75
  }
76
  default:
77
- log.Fatalf("unsupported --network value. Must be one of: [%s, %s, %s]", mainnet, testnet, cardona, custom)
78
  }
79
  config, err := LoadGenesisFromJSONString(networkJSON)
80
  if err != nil {
@@ -122,9 +115,10 @@
122
 
123
  cfg.L1Config = cfgJSON.L1Config
124
  cfg.Genesis = state.Genesis{
125
- BlockNumber: cfgJSON.GenesisBlockNum,
126
- Root: common.HexToHash(cfgJSON.Root),
127
- Actions: []*state.GenesisAction{},
 
128
  }
129
 
130
  for _, account := range cfgJSON.Genesis {
 
25
 
26
  type network string
27
 
 
 
 
28
  const custom network = "custom"
29
 
30
  // GenesisFromJSON is the config file for network_custom
31
  type GenesisFromJSON struct {
32
  // L1: root hash of the genesis block
33
  Root string `json:"root"`
34
+ // L1: block number in which the rollup was created
35
+ RollupCreationBlockNum uint64 `json:"rollupCreationBlockNumber"`
36
+ // L1: block number in which the rollup manager was created
37
+ RollupManagerCreationBlockNum uint64 `json:"rollupManagerCreationBlockNumber"`
38
  // L2: List of states contracts used to populate merkle tree at initial state
39
  Genesis []genesisAccountFromJSON `json:"genesis"`
40
  // L1: configuration of the network
 
59
  func (cfg *Config) loadNetworkConfig(ctx *cli.Context) {
60
  var networkJSON string
61
  switch ctx.String(FlagNetwork) {
 
 
 
 
 
 
62
  case string(custom):
63
  var err error
64
  cfgPath := ctx.String(FlagCustomNetwork)
 
67
  panic(err.Error())
68
  }
69
  default:
70
+ log.Fatalf("unsupported --network value. Must be %s", custom)
71
  }
72
  config, err := LoadGenesisFromJSONString(networkJSON)
73
  if err != nil {
 
115
 
116
  cfg.L1Config = cfgJSON.L1Config
117
  cfg.Genesis = state.Genesis{
118
+ RollupBlockNumber: cfgJSON.RollupCreationBlockNum,
119
+ RollupManagerBlockNumber: cfgJSON.RollupManagerCreationBlockNum,
120
+ Root: common.HexToHash(cfgJSON.Root),
121
+ Actions: []*state.GenesisAction{},
122
  }
123
 
124
  for _, account := range cfgJSON.Genesis {
{/home/stefan/go/src/Polygon/zkevm-node → .}/config/network_test.go RENAMED
@@ -14,18 +13,6 @@
14
  "github.com/urfave/cli/v2"
15
  )
16
 
17
- func TestCardona(t *testing.T) {
18
- cfg := Config{}
19
- fs := flag.NewFlagSet("", flag.ExitOnError)
20
- fs.String(FlagNetwork, string(cardona), string(cardona))
21
- err := fs.Set(FlagNetwork, string(cardona))
22
- require.NoError(t, err)
23
- app := cli.NewApp()
24
- ctx := cli.NewContext(app, fs, nil)
25
-
26
- log.Info("flag=", ctx.String(FlagNetwork))
27
- cfg.loadNetworkConfig(ctx)
28
- }
29
  func TestLoadCustomNetworkConfig(t *testing.T) {
30
  tcs := []struct {
31
  description string
@@ -37,7 +24,8 @@
37
  description: "happy path",
38
  inputConfigStr: `{
39
  "root": "0xBEEF",
40
- "genesisBlockNumber": 69,
 
41
  "l1Config" : {
42
  "chainId": 420,
43
  "polygonZkEVMAddress": "0xc949254d682d8c9ad5682521675b8f43b102aec4",
@@ -89,8 +77,9 @@
89
  GlobalExitRootManagerAddr: common.HexToAddress("0xc949254d682d8c9ad5682521675b8f43b102aec4"),
90
  },
91
  Genesis: state.Genesis{
92
- Root: common.HexToHash("0xBEEF"),
93
- BlockNumber: 69,
 
94
  Actions: []*state.GenesisAction{
95
  {
96
  Address: "0xc949254d682d8c9ad5682521675b8f43b102aec4",
 
13
  "github.com/urfave/cli/v2"
14
  )
15
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  func TestLoadCustomNetworkConfig(t *testing.T) {
17
  tcs := []struct {
18
  description string
 
24
  description: "happy path",
25
  inputConfigStr: `{
26
  "root": "0xBEEF",
27
+ "rollupCreationBlockNumber": 69,
28
+ "rollupManagerCreationBlockNumber": 60,
29
  "l1Config" : {
30
  "chainId": 420,
31
  "polygonZkEVMAddress": "0xc949254d682d8c9ad5682521675b8f43b102aec4",
 
77
  GlobalExitRootManagerAddr: common.HexToAddress("0xc949254d682d8c9ad5682521675b8f43b102aec4"),
78
  },
79
  Genesis: state.Genesis{
80
+ Root: common.HexToHash("0xBEEF"),
81
+ RollupBlockNumber: 69,
82
+ RollupManagerBlockNumber: 60,
83
  Actions: []*state.GenesisAction{
84
  {
85
  Address: "0xc949254d682d8c9ad5682521675b8f43b102aec4",
{/home/stefan/go/src/Polygon/zkevm-node → .}/config/testnetgenesis.go RENAMED
@@ -1,108 +0,0 @@
1
- package config
2
-
3
- // TestnetNetworkConfigJSON is the hardcoded network configuration to be used for the official mainnet setup
4
- const TestnetNetworkConfigJSON = `
5
- {
6
- "l1Config" : {
7
- "chainId": 5,
8
- "polygonZkEVMAddress": "0xa997cfD539E703921fD1e3Cf25b4c241a27a4c7A",
9
- "polTokenAddress": "0x1319D23c2F7034F52Eb07399702B040bA278Ca49",
10
- "polygonZkEVMGlobalExitRootAddress": "0x4d9427DCA0406358445bC0a8F88C26b704004f74"
11
- },
12
- "root": "0x13a14c4a8288e782863d7ce916d224546c69dc428fbfa7115a0cc33a27a05b26",
13
- "genesisBlockNumber": 8572998,
14
- "genesis": [
15
- {
16
- "contractName": "PolygonZkEVMDeployer",
17
- "balance": "0",
18
- "nonce": "4",
19
- "address": "0x39877a0c3cd148476DaA2475c77c478C62eC7509",
20
- "bytecode": "0x6080604052600436106100705760003560e01c8063715018a61161004e578063715018a6146100e65780638da5cb5b146100fb578063e11ae6cb14610126578063f2fde38b1461013957600080fd5b80632b79805a146100755780634a94d4871461008a5780636d07dbf81461009d575b600080fd5b610088610083366004610927565b610159565b005b6100886100983660046109c7565b6101cb565b3480156100a957600080fd5b506100bd6100b8366004610a1e565b61020d565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b50610088610220565b34801561010757600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100bd565b610088610134366004610a40565b610234565b34801561014557600080fd5b50610088610154366004610a90565b61029b565b610161610357565b600061016e8585856103d8565b905061017a8183610537565b5060405173ffffffffffffffffffffffffffffffffffffffff821681527fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a15050505050565b6101d3610357565b6101de83838361057b565b506040517f25adb19089b6a549831a273acdf7908cff8b7ee5f551f8d1d37996cf01c5df5b90600090a1505050565b600061021983836105a9565b9392505050565b610228610357565b61023260006105b6565b565b61023c610357565b60006102498484846103d8565b60405173ffffffffffffffffffffffffffffffffffffffff821681529091507fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a150505050565b6102a3610357565b73ffffffffffffffffffffffffffffffffffffffff811661034b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610354816105b6565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610232576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610342565b600083471015610444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e63650000006044820152606401610342565b81516000036104af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152606401610342565b8282516020840186f5905073ffffffffffffffffffffffffffffffffffffffff8116610219576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152606401610342565b6060610219838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c6564000081525061062b565b60606105a1848484604051806060016040528060298152602001610b3d6029913961062b565b949350505050565b6000610219838330610744565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060824710156106bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610342565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516106e69190610acf565b60006040518083038185875af1925050503d8060008114610723576040519150601f19603f3d011682016040523d82523d6000602084013e610728565b606091505b50915091506107398783838761076e565b979650505050505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b606083156108045782516000036107fd5773ffffffffffffffffffffffffffffffffffffffff85163b6107fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610342565b50816105a1565b6105a183838151156108195781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103429190610aeb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261088d57600080fd5b813567ffffffffffffffff808211156108a8576108a861084d565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156108ee576108ee61084d565b8160405283815286602085880101111561090757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806080858703121561093d57600080fd5b8435935060208501359250604085013567ffffffffffffffff8082111561096357600080fd5b61096f8883890161087c565b9350606087013591508082111561098557600080fd5b506109928782880161087c565b91505092959194509250565b803573ffffffffffffffffffffffffffffffffffffffff811681146109c257600080fd5b919050565b6000806000606084860312156109dc57600080fd5b6109e58461099e565b9250602084013567ffffffffffffffff811115610a0157600080fd5b610a0d8682870161087c565b925050604084013590509250925092565b60008060408385031215610a3157600080fd5b50508035926020909101359150565b600080600060608486031215610a5557600080fd5b8335925060208401359150604084013567ffffffffffffffff811115610a7a57600080fd5b610a868682870161087c565b9150509250925092565b600060208284031215610aa257600080fd5b6102198261099e565b60005b83811015610ac6578181015183820152602001610aae565b50506000910152565b60008251610ae1818460208701610aab565b9190910192915050565b6020815260008251806020840152610b0a816040850160208701610aab565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a26469706673582212200b8e3cd6bd762444a7eeff86e1cfcd7e1ce9524b715dcb70b2a4c2b70fd5188464736f6c63430008110033",
21
- "storage": {
22
- "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000a0b02b28920812324f1cc3255bd8840867d3f227"
23
- }
24
- },
25
- {
26
- "contractName": "ProxyAdmin",
27
- "balance": "0",
28
- "nonce": "1",
29
- "address": "0x40797c2f93298a44a893F43EdF1B33B63d7BA333",
30
- "bytecode": "0x60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461012b57806399a88ec41461013e578063f2fde38b1461015e578063f3b7dead1461017e57600080fd5b8063204e1c7a14610080578063715018a6146100c95780637eff275e146100e05780638da5cb5b14610100575b600080fd5b34801561008c57600080fd5b506100a061009b366004610608565b61019e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100d557600080fd5b506100de610255565b005b3480156100ec57600080fd5b506100de6100fb36600461062c565b610269565b34801561010c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100a0565b6100de610139366004610694565b6102f7565b34801561014a57600080fd5b506100de61015936600461062c565b61038c565b34801561016a57600080fd5b506100de610179366004610608565b6103e8565b34801561018a57600080fd5b506100a0610199366004610608565b6104a4565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907f5c60da1b00000000000000000000000000000000000000000000000000000000815260040190565b600060405180830381855afa9150503d8060008114610225576040519150601f19603f3d011682016040523d82523d6000602084013e61022a565b606091505b50915091508161023957600080fd5b8080602001905181019061024d9190610788565b949350505050565b61025d6104f0565b6102676000610571565b565b6102716104f0565b6040517f8f28397000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690638f283970906024015b600060405180830381600087803b1580156102db57600080fd5b505af11580156102ef573d6000803e3d6000fd5b505050505050565b6102ff6104f0565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef28690349061035590869086906004016107a5565b6000604051808303818588803b15801561036e57600080fd5b505af1158015610382573d6000803e3d6000fd5b5050505050505050565b6103946104f0565b6040517f3659cfe600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690633659cfe6906024016102c1565b6103f06104f0565b73ffffffffffffffffffffffffffffffffffffffff8116610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6104a181610571565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907ff851a44000000000000000000000000000000000000000000000000000000000815260040190565b60005473ffffffffffffffffffffffffffffffffffffffff163314610267576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161048f565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff811681146104a157600080fd5b60006020828403121561061a57600080fd5b8135610625816105e6565b9392505050565b6000806040838503121561063f57600080fd5b823561064a816105e6565b9150602083013561065a816105e6565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156106a957600080fd5b83356106b4816105e6565b925060208401356106c4816105e6565b9150604084013567ffffffffffffffff808211156106e157600080fd5b818601915086601f8301126106f557600080fd5b81358181111561070757610707610665565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561074d5761074d610665565b8160405282815289602084870101111561076657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60006020828403121561079a57600080fd5b8151610625816105e6565b73ffffffffffffffffffffffffffffffffffffffff8316815260006020604081840152835180604085015260005b818110156107ef578581018301518582016060015282016107d3565b5060006060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010192505050939250505056fea2646970667358221220babd4ff1f5daee002b96cc86d8bb6c2c2c210ae3132df5ea384713352f7f15fe64736f6c63430008110033",
31
- "storage": {
32
- "0x0000000000000000000000000000000000000000000000000000000000000000": "0x00000000000000000000000002245d7b6cb0b6870d1e28ac877ee355b9588869"
33
- }
34
- },
35
- {
36
- "contractName": "PolygonZkEVMBridge implementation",
37
- "balance": "0",
38
- "nonce": "1",
39
- "address": "0x39e780D8800f7396e8B7530A8925B14025AedC77",
40
- "bytecode": "0x6080604052600436106200019f5760003560e01c8063647c576c11620000e7578063be5831c71162000089578063dbc169761162000060578063dbc169761462000639578063ee25560b1462000651578063fb570834146200068257600080fd5b8063be5831c714620005ae578063cd58657914620005ea578063d02103ca146200060157600080fd5b80639e34070f11620000be5780639e34070f146200050a578063aaa13cc2146200054f578063bab161bf146200057457600080fd5b8063647c576c146200048657806379e2cf9714620004ab57806381b1c17414620004c357600080fd5b80632d2c9d94116200015157806334ac9cf2116200012857806334ac9cf2146200034b5780633ae05047146200037a5780633e197043146200039257600080fd5b80632d2c9d9414620002765780632dfdf0b5146200029b578063318aee3d14620002c257600080fd5b806322e95f2c116200018657806322e95f2c14620001ef578063240ff378146200023a5780632cffd02e146200025157600080fd5b806315064c9614620001a45780632072f6c514620001d5575b600080fd5b348015620001b157600080fd5b50606854620001c09060ff1681565b60405190151581526020015b60405180910390f35b348015620001e257600080fd5b50620001ed620006a7565b005b348015620001fc57600080fd5b50620002146200020e366004620032db565b62000705565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001620001cc565b620001ed6200024b36600462003372565b620007a8565b3480156200025e57600080fd5b50620001ed6200027036600462003409565b620009d0565b3480156200028357600080fd5b50620001ed6200029536600462003409565b62000f74565b348015620002a857600080fd5b50620002b360535481565b604051908152602001620001cc565b348015620002cf57600080fd5b5062000319620002e1366004620034ef565b606b6020526000908152604090205463ffffffff811690640100000000900473ffffffffffffffffffffffffffffffffffffffff1682565b6040805163ffffffff909316835273ffffffffffffffffffffffffffffffffffffffff909116602083015201620001cc565b3480156200035857600080fd5b50606c54620002149073ffffffffffffffffffffffffffffffffffffffff1681565b3480156200038757600080fd5b50620002b362001178565b3480156200039f57600080fd5b50620002b3620003b136600462003526565b6040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b3480156200049357600080fd5b50620001ed620004a5366004620035b0565b6200125e565b348015620004b857600080fd5b50620001ed620014ad565b348015620004d057600080fd5b5062000214620004e236600462003600565b606a6020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200051757600080fd5b50620001c06200052936600462003600565b600881901c600090815260696020526040902054600160ff9092169190911b9081161490565b3480156200055c57600080fd5b50620002146200056e3660046200361a565b620014e7565b3480156200058157600080fd5b506068546200059890610100900463ffffffff1681565b60405163ffffffff9091168152602001620001cc565b348015620005bb57600080fd5b506068546200059890790100000000000000000000000000000000000000000000000000900463ffffffff1681565b620001ed620005fb366004620036ce565b620016d3565b3480156200060e57600080fd5b50606854620002149065010000000000900473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200064657600080fd5b50620001ed62001c37565b3480156200065e57600080fd5b50620002b36200067036600462003600565b60696020526000908152604090205481565b3480156200068f57600080fd5b50620001c0620006a136600462003770565b62001c93565b606c5473ffffffffffffffffffffffffffffffffffffffff163314620006f9576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362001d7c565b565b6040805160e084901b7fffffffff0000000000000000000000000000000000000000000000000000000016602080830191909152606084901b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602483015282516018818403018152603890920183528151918101919091206000908152606a909152205473ffffffffffffffffffffffffffffffffffffffff165b92915050565b60685460ff1615620007e6576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff8681166101009092041614806200080c5750600263ffffffff861610155b1562000844576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b6001606860019054906101000a900463ffffffff163388883488886053546040516200089a9998979695949392919062003806565b60405180910390a1620009b8620009b26001606860019054906101000a900463ffffffff16338989348989604051620008d592919062003881565b60405180910390206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b62001e10565b8215620009c957620009c962001f27565b5050505050565b60685460ff161562000a0e576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000a258b8b8b8b8b8b8b8b8b8b8b600062001ffc565b73ffffffffffffffffffffffffffffffffffffffff861662000b01576040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff861690859060405162000a7a9190620038e6565b60006040518083038185875af1925050503d806000811462000ab9576040519150601f19603f3d011682016040523d82523d6000602084013e62000abe565b606091505b505090508062000afa576040517f6747a28800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5062000efc565b60685463ffffffff61010090910481169088160362000b435762000b3d73ffffffffffffffffffffffffffffffffffffffff87168585620021ed565b62000efc565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b166024820152600090603801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000818152606a90935291205490915073ffffffffffffffffffffffffffffffffffffffff168062000e6e576000808062000c1886880188620039fb565b92509250925060008584848460405162000c329062003292565b62000c409392919062003abd565b8190604051809103906000f590508015801562000c61573d6000803e3d6000fd5b506040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c81166004830152602482018c9052919250908216906340c10f1990604401600060405180830381600087803b15801562000cd757600080fd5b505af115801562000cec573d6000803e3d6000fd5b5050505080606a600088815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060405180604001604052808e63ffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff16815250606b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050507f490e59a1701b938786ac72570a1efeac994a3dbe96e2e883e19e902ace6e6a398d8d838b8b60405162000e5c95949392919062003afa565b60405180910390a15050505062000ef9565b6040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018790528216906340c10f1990604401600060405180830381600087803b15801562000edf57600080fd5b505af115801562000ef4573d6000803e3d6000fd5b505050505b50505b6040805163ffffffff8c811682528916602082015273ffffffffffffffffffffffffffffffffffffffff88811682840152861660608201526080810185905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a15050505050505050505050565b60685460ff161562000fb2576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000fc98b8b8b8b8b8b8b8b8b8b8b600162001ffc565b60008473ffffffffffffffffffffffffffffffffffffffff1684888a868660405160240162000ffc949392919062003b42565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1806b5f200000000000000000000000000000000000000000000000000000000179052516200107f9190620038e6565b60006040518083038185875af1925050503d8060008114620010be576040519150601f19603f3d011682016040523d82523d6000602084013e620010c3565b606091505b5050905080620010ff576040517f37e391c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805163ffffffff8d811682528a16602082015273ffffffffffffffffffffffffffffffffffffffff89811682840152871660608201526080810186905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a1505050505050505050505050565b605354600090819081805b602081101562001255578083901c600116600103620011e65760338160208110620011b257620011b262003b8a565b0154604080516020810192909252810185905260600160405160208183030381529060405280519060200120935062001213565b60408051602081018690529081018390526060016040516020818303038152906040528051906020012093505b604080516020810184905290810183905260600160405160208183030381529060405280519060200120915080806200124c9062003be8565b91505062001183565b50919392505050565b600054610100900460ff16158080156200127f5750600054600160ff909116105b806200129b5750303b1580156200129b575060005460ff166001145b6200132d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156200138c57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b606880547fffffffffffffff000000000000000000000000000000000000000000000000ff1661010063ffffffff8716027fffffffffffffff0000000000000000000000000000000000000000ffffffffff16176501000000000073ffffffffffffffffffffffffffffffffffffffff8681169190910291909117909155606c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001691841691909117905562001443620022c3565b8015620014a757600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b605354606854790100000000000000000000000000000000000000000000000000900463ffffffff16101562000703576200070362001f27565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b1660248201526000908190603801604051602081830303815290604052805190602001209050600060ff60f81b3083604051806020016200157d9062003292565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082820381018352601f909101166040819052620015c8908d908d908d908d908d9060200162003c23565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905262001606929160200162003c64565b604051602081830303815290604052805190602001206040516020016200168f94939291907fff0000000000000000000000000000000000000000000000000000000000000094909416845260609290921b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660018401526015830152603582015260550190565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815291905280516020909101209a9950505050505050505050565b60685460ff161562001711576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200171b62002366565b60685463ffffffff888116610100909204161480620017415750600263ffffffff881610155b1562001779576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060608773ffffffffffffffffffffffffffffffffffffffff8816620017df57883414620017d5576040517fb89240f500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000925062001ad9565b341562001818576040517f798ee6f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8089166000908152606b602090815260409182902082518084019093525463ffffffff811683526401000000009004909216918101829052901562001908576040517f9dc29fac000000000000000000000000000000000000000000000000000000008152336004820152602481018b905273ffffffffffffffffffffffffffffffffffffffff8a1690639dc29fac90604401600060405180830381600087803b158015620018db57600080fd5b505af1158015620018f0573d6000803e3d6000fd5b50505050806020015194508060000151935062001ad7565b85156200191d576200191d898b8989620023db565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8b16906370a0823190602401602060405180830381865afa1580156200198b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620019b1919062003c97565b9050620019d773ffffffffffffffffffffffffffffffffffffffff8b1633308e620028f9565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa15801562001a45573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001a6b919062003c97565b905062001a79828262003cb1565b6068548c9850610100900463ffffffff169650935062001a998762002959565b62001aa48c62002a71565b62001aaf8d62002b7e565b60405160200162001ac39392919062003abd565b604051602081830303815290604052945050505b505b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b600084868e8e868860535460405162001b1b98979695949392919062003cc7565b60405180910390a162001c0f620009b2600085878f8f8789805190602001206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b861562001c205762001c2062001f27565b5050505062001c2e60018055565b50505050505050565b606c5473ffffffffffffffffffffffffffffffffffffffff16331462001c89576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362002c80565b600084815b602081101562001d6e57600163ffffffff8616821c8116900362001d0a5785816020811062001ccb5762001ccb62003b8a565b60200201358260405160200162001cec929190918252602082015260400190565b60405160208183030381529060405280519060200120915062001d59565b8186826020811062001d205762001d2062003b8a565b602002013560405160200162001d40929190918252602082015260400190565b6040516020818303038152906040528051906020012091505b8062001d658162003be8565b91505062001c98565b50821490505b949350505050565b60685460ff161562001dba576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556040517f2261efe5aef6fedc1fd1550b25facc9181745623049c7901287030b9ad1a549790600090a1565b80600162001e216020600262003e79565b62001e2d919062003cb1565b6053541062001e68576040517fef5ccf6600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060536000815462001e7b9062003be8565b9182905550905060005b602081101562001f17578082901c60011660010362001ebd57826033826020811062001eb55762001eb562003b8a565b015550505050565b6033816020811062001ed35762001ed362003b8a565b01546040805160208101929092528101849052606001604051602081830303815290604052805190602001209250808062001f0e9062003be8565b91505062001e85565b5062001f2262003e87565b505050565b6053546068805463ffffffff909216790100000000000000000000000000000000000000000000000000027fffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffff909216919091179081905573ffffffffffffffffffffffffffffffffffffffff65010000000000909104166333d6247d62001fad62001178565b6040518263ffffffff1660e01b815260040162001fcc91815260200190565b600060405180830381600087803b15801562001fe757600080fd5b505af1158015620014a7573d6000803e3d6000fd5b6200200d8b63ffffffff1662002d10565b6068546040805160208082018e90528183018d9052825180830384018152606083019384905280519101207f257b363200000000000000000000000000000000000000000000000000000000909252606481019190915260009165010000000000900473ffffffffffffffffffffffffffffffffffffffff169063257b3632906084016020604051808303816000875af1158015620020b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620020d6919062003c97565b90508060000362002112576040517e2f6fad00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff88811661010090920416146200215c576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606854600090610100900463ffffffff166200217a5750896200217d565b508a5b620021a66200219d848c8c8c8c8c8c8c604051620008d592919062003881565b8f8f8462001c93565b620021dd576040517fe0417cec00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905262001f229084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262002d75565b600054610100900460ff166200235c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6200070362002e88565b600260015403620023d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640162001324565b6002600155565b6000620023ec600482848662003eb6565b620023f79162003ee2565b90507f2afa5331000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000821601620026765760008080808080806200245a896004818d62003eb6565b81019062002469919062003f2b565b96509650965096509650965096503373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614620024dd576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff861630146200252d576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8a851462002567576040517f03fffc4b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff89811660248301528881166044830152606482018890526084820187905260ff861660a483015260c4820185905260e48083018590528351808403909101815261010490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fd505accf000000000000000000000000000000000000000000000000000000001790529151918e1691620026229190620038e6565b6000604051808303816000865af19150503d806000811462002661576040519150601f19603f3d011682016040523d82523d6000602084013e62002666565b606091505b50505050505050505050620009c9565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f8fcbaf0c0000000000000000000000000000000000000000000000000000000014620026f2576040517fe282c0ba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080808080806200270a8a6004818e62003eb6565b81019062002719919062003f86565b975097509750975097509750975097503373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16146200278f576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff87163014620027df576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8a811660248301528981166044830152606482018990526084820188905286151560a483015260ff861660c483015260e482018590526101048083018590528351808403909101815261012490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f8fcbaf0c000000000000000000000000000000000000000000000000000000001790529151918f1691620028a39190620038e6565b6000604051808303816000865af19150503d8060008114620028e2576040519150601f19603f3d011682016040523d82523d6000602084013e620028e7565b606091505b50505050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052620014a79085907f23b872dd000000000000000000000000000000000000000000000000000000009060840162002240565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f06fdde03000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff861691620029dd9190620038e6565b600060405180830381855afa9150503d806000811462002a1a576040519150601f19603f3d011682016040523d82523d6000602084013e62002a1f565b606091505b50915091508162002a66576040518060400160405280600781526020017f4e4f5f4e414d450000000000000000000000000000000000000000000000000081525062001d74565b62001d748162002f21565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f95d89b41000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff86169162002af59190620038e6565b600060405180830381855afa9150503d806000811462002b32576040519150601f19603f3d011682016040523d82523d6000602084013e62002b37565b606091505b50915091508162002a66576040518060400160405280600981526020017f4e4f5f53594d424f4c000000000000000000000000000000000000000000000081525062001d74565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f313ce5670000000000000000000000000000000000000000000000000000000017905290516000918291829173ffffffffffffffffffffffffffffffffffffffff86169162002c019190620038e6565b600060405180830381855afa9150503d806000811462002c3e576040519150601f19603f3d011682016040523d82523d6000602084013e62002c43565b606091505b509150915081801562002c57575080516020145b62002c6457601262001d74565b8080602001905181019062001d74919062004012565b60018055565b60685460ff1662002cbd576040517f5386698100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040517f1e5e34eea33501aecf2ebec9fe0e884a40804275ea7fe10b2ba084c8374308b390600090a1565b600881901c60008181526069602052604081208054600160ff861690811b91821892839055929091908183169003620009c9576040517f646cf55800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600062002dd9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16620031119092919063ffffffff16565b80519091501562001f22578080602001905181019062002dfa919062004032565b62001f22576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840162001324565b600054610100900460ff1662002c7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6060604082511062002f435781806020019051810190620007a2919062004052565b8151602003620030d35760005b60208110801562002f9b575082818151811062002f715762002f7162003b8a565b01602001517fff000000000000000000000000000000000000000000000000000000000000001615155b1562002fb6578062002fad8162003be8565b91505062002f50565b8060000362002ffa57505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e4700000000000000000000000000006020820152919050565b60008167ffffffffffffffff81111562003018576200301862003891565b6040519080825280601f01601f19166020018201604052801562003043576020820181803683370190505b50905060005b82811015620030cb5784818151811062003067576200306762003b8a565b602001015160f81c60f81b82828151811062003087576200308762003b8a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080620030c28162003be8565b91505062003049565b509392505050565b505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e470000000000000000000000000000602082015290565b919050565b606062001d748484600085856000808673ffffffffffffffffffffffffffffffffffffffff168587604051620031489190620038e6565b60006040518083038185875af1925050503d806000811462003187576040519150601f19603f3d011682016040523d82523d6000602084013e6200318c565b606091505b50915091506200319f87838387620031aa565b979650505050505050565b60608315620032455782516000036200323d5773ffffffffffffffffffffffffffffffffffffffff85163b6200323d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162001324565b508162001d74565b62001d7483838151156200325c5781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620013249190620040d2565b611b6680620040e883390190565b803563ffffffff811681146200310c57600080fd5b73ffffffffffffffffffffffffffffffffffffffff81168114620032d857600080fd5b50565b60008060408385031215620032ef57600080fd5b620032fa83620032a0565b915060208301356200330c81620032b5565b809150509250929050565b8015158114620032d857600080fd5b60008083601f8401126200333957600080fd5b50813567ffffffffffffffff8111156200335257600080fd5b6020830191508360208285010111156200336b57600080fd5b9250929050565b6000806000806000608086880312156200338b57600080fd5b6200339686620032a0565b94506020860135620033a881620032b5565b93506040860135620033ba8162003317565b9250606086013567ffffffffffffffff811115620033d757600080fd5b620033e58882890162003326565b969995985093965092949392505050565b806104008101831015620007a257600080fd5b60008060008060008060008060008060006105208c8e0312156200342c57600080fd5b620034388d8d620033f6565b9a50620034496104008d01620032a0565b99506104208c013598506104408c013597506200346a6104608d01620032a0565b96506104808c01356200347d81620032b5565b95506200348e6104a08d01620032a0565b94506104c08c0135620034a181620032b5565b93506104e08c013592506105008c013567ffffffffffffffff811115620034c757600080fd5b620034d58e828f0162003326565b915080935050809150509295989b509295989b9093969950565b6000602082840312156200350257600080fd5b81356200350f81620032b5565b9392505050565b60ff81168114620032d857600080fd5b600080600080600080600060e0888a0312156200354257600080fd5b87356200354f8162003516565b96506200355f60208901620032a0565b955060408801356200357181620032b5565b94506200358160608901620032a0565b935060808801356200359381620032b5565b9699959850939692959460a0840135945060c09093013592915050565b600080600060608486031215620035c657600080fd5b620035d184620032a0565b92506020840135620035e381620032b5565b91506040840135620035f581620032b5565b809150509250925092565b6000602082840312156200361357600080fd5b5035919050565b600080600080600080600060a0888a0312156200363657600080fd5b6200364188620032a0565b965060208801356200365381620032b5565b9550604088013567ffffffffffffffff808211156200367157600080fd5b6200367f8b838c0162003326565b909750955060608a01359150808211156200369957600080fd5b50620036a88a828b0162003326565b9094509250506080880135620036be8162003516565b8091505092959891949750929550565b600080600080600080600060c0888a031215620036ea57600080fd5b620036f588620032a0565b965060208801356200370781620032b5565b95506040880135945060608801356200372081620032b5565b93506080880135620037328162003317565b925060a088013567ffffffffffffffff8111156200374f57600080fd5b6200375d8a828b0162003326565b989b979a50959850939692959293505050565b60008060008061046085870312156200378857600080fd5b843593506200379b8660208701620033f6565b9250620037ac6104208601620032a0565b939692955092936104400135925050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b600061010060ff8c16835263ffffffff808c16602085015273ffffffffffffffffffffffffffffffffffffffff808c166040860152818b166060860152808a166080860152508760a08501528160c0850152620038678285018789620037bd565b925080851660e085015250509a9950505050505050505050565b8183823760009101908152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60005b83811015620038dd578181015183820152602001620038c3565b50506000910152565b60008251620038fa818460208701620038c0565b9190910192915050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156200394e576200394e62003891565b604052919050565b600067ffffffffffffffff82111562003973576200397362003891565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112620039b157600080fd5b8135620039c8620039c28262003956565b62003904565b818152846020838601011115620039de57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121562003a1157600080fd5b833567ffffffffffffffff8082111562003a2a57600080fd5b62003a38878388016200399f565b9450602086013591508082111562003a4f57600080fd5b5062003a5e868287016200399f565b9250506040840135620035f58162003516565b6000815180845262003a8b816020860160208601620038c0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60608152600062003ad2606083018662003a71565b828103602084015262003ae6818662003a71565b91505060ff83166040830152949350505050565b63ffffffff86168152600073ffffffffffffffffffffffffffffffffffffffff8087166020840152808616604084015250608060608301526200319f608083018486620037bd565b73ffffffffffffffffffffffffffffffffffffffff8516815263ffffffff8416602082015260606040820152600062003b80606083018486620037bd565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820362003c1c5762003c1c62003bb9565b5060010190565b60608152600062003c39606083018789620037bd565b828103602084015262003c4e818688620037bd565b91505060ff831660408301529695505050505050565b6000835162003c78818460208801620038c0565b83519083019062003c8e818360208801620038c0565b01949350505050565b60006020828403121562003caa57600080fd5b5051919050565b81810381811115620007a257620007a262003bb9565b600061010060ff8b16835263ffffffff808b16602085015273ffffffffffffffffffffffffffffffffffffffff808b166040860152818a1660608601528089166080860152508660a08501528160c085015262003d278285018762003a71565b925080851660e085015250509998505050505050505050565b600181815b8085111562003d9f57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003d835762003d8362003bb9565b8085161562003d9157918102915b93841c939080029062003d45565b509250929050565b60008262003db857506001620007a2565b8162003dc757506000620007a2565b816001811462003de0576002811462003deb5762003e0b565b6001915050620007a2565b60ff84111562003dff5762003dff62003bb9565b50506001821b620007a2565b5060208310610133831016604e8410600b841016171562003e30575081810a620007a2565b62003e3c838362003d40565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003e715762003e7162003bb9565b029392505050565b60006200350f838362003da7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b6000808585111562003ec757600080fd5b8386111562003ed557600080fd5b5050820193919092039150565b7fffffffff00000000000000000000000000000000000000000000000000000000813581811691600485101562003f235780818660040360031b1b83161692505b505092915050565b600080600080600080600060e0888a03121562003f4757600080fd5b873562003f5481620032b5565b9650602088013562003f6681620032b5565b955060408801359450606088013593506080880135620035938162003516565b600080600080600080600080610100898b03121562003fa457600080fd5b883562003fb181620032b5565b9750602089013562003fc381620032b5565b96506040890135955060608901359450608089013562003fe38162003317565b935060a089013562003ff58162003516565b979a969950949793969295929450505060c08201359160e0013590565b6000602082840312156200402557600080fd5b81516200350f8162003516565b6000602082840312156200404557600080fd5b81516200350f8162003317565b6000602082840312156200406557600080fd5b815167ffffffffffffffff8111156200407d57600080fd5b8201601f810184136200408f57600080fd5b8051620040a0620039c28262003956565b818152856020838501011115620040b657600080fd5b620040c9826020830160208601620038c0565b95945050505050565b6020815260006200350f602083018462003a7156fe6101006040523480156200001257600080fd5b5060405162001b6638038062001b6683398101604081905262000035916200028d565b82826003620000458382620003a1565b506004620000548282620003a1565b50503360c0525060ff811660e052466080819052620000739062000080565b60a052506200046d915050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620000ad6200012e565b805160209182012060408051808201825260018152603160f81b90840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b6060600380546200013f9062000312565b80601f01602080910402602001604051908101604052809291908181526020018280546200016d9062000312565b8015620001be5780601f106200019257610100808354040283529160200191620001be565b820191906000526020600020905b815481529060010190602001808311620001a057829003601f168201915b5050505050905090565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001f057600080fd5b81516001600160401b03808211156200020d576200020d620001c8565b604051601f8301601f19908116603f01168101908282118183101715620002385762000238620001c8565b816040528381526020925086838588010111156200025557600080fd5b600091505b838210156200027957858201830151818301840152908201906200025a565b600093810190920192909252949350505050565b600080600060608486031215620002a357600080fd5b83516001600160401b0380821115620002bb57600080fd5b620002c987838801620001de565b94506020860151915080821115620002e057600080fd5b50620002ef86828701620001de565b925050604084015160ff811681146200030757600080fd5b809150509250925092565b600181811c908216806200032757607f821691505b6020821081036200034857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200039c57600081815260208120601f850160051c81016020861015620003775750805b601f850160051c820191505b81811015620003985782815560010162000383565b5050505b505050565b81516001600160401b03811115620003bd57620003bd620001c8565b620003d581620003ce845462000312565b846200034e565b602080601f8311600181146200040d5760008415620003f45750858301515b600019600386901b1c1916600185901b17855562000398565b600085815260208120601f198616915b828110156200043e578886015182559484019460019091019084016200041d565b50858210156200045d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e0516116aa620004bc6000396000610237015260008181610307015281816105c001526106a70152600061053a015260008181610379015261050401526116aa6000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806370a08231116100d8578063a457c2d71161008c578063d505accf11610066578063d505accf1461039b578063dd62ed3e146103ae578063ffa1ad74146103f457600080fd5b8063a457c2d71461034e578063a9059cbb14610361578063cd0d00961461037457600080fd5b806395d89b41116100bd57806395d89b41146102e75780639dc29fac146102ef578063a3c573eb1461030257600080fd5b806370a08231146102915780637ecebe00146102c757600080fd5b806330adf81f1161012f5780633644e515116101145780633644e51514610261578063395093511461026957806340c10f191461027c57600080fd5b806330adf81f14610209578063313ce5671461023057600080fd5b806318160ddd1161016057806318160ddd146101bd57806320606b70146101cf57806323b872dd146101f657600080fd5b806306fdde031461017c578063095ea7b31461019a575b600080fd5b610184610430565b60405161019191906113e4565b60405180910390f35b6101ad6101a8366004611479565b6104c2565b6040519015158152602001610191565b6002545b604051908152602001610191565b6101c17f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b6101ad6102043660046114a3565b6104dc565b6101c17f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610191565b6101c1610500565b6101ad610277366004611479565b61055c565b61028f61028a366004611479565b6105a8565b005b6101c161029f3660046114df565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6101c16102d53660046114df565b60056020526000908152604090205481565b610184610680565b61028f6102fd366004611479565b61068f565b6103297f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610191565b6101ad61035c366004611479565b61075e565b6101ad61036f366004611479565b61082f565b6101c17f000000000000000000000000000000000000000000000000000000000000000081565b61028f6103a9366004611501565b61083d565b6101c16103bc366004611574565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6101846040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b60606003805461043f906115a7565b80601f016020809104026020016040519081016040528092919081815260200182805461046b906115a7565b80156104b85780601f1061048d576101008083540402835291602001916104b8565b820191906000526020600020905b81548152906001019060200180831161049b57829003601f168201915b5050505050905090565b6000336104d0818585610b73565b60019150505b92915050565b6000336104ea858285610d27565b6104f5858585610dfe565b506001949350505050565b60007f00000000000000000000000000000000000000000000000000000000000000004614610537576105324661106d565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906104d090829086906105a3908790611629565b610b73565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610672576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d4272696467650000000000000000000000000000000060648201526084015b60405180910390fd5b61067c8282611135565b5050565b60606004805461043f906115a7565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610754576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d427269646765000000000000000000000000000000006064820152608401610669565b61067c8282611228565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610669565b6104f58286868403610b73565b6000336104d0818585610dfe565b834211156108cc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f546f6b656e577261707065643a3a7065726d69743a204578706972656420706560448201527f726d6974000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260056020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a9190866109268361163c565b9091555060408051602081019690965273ffffffffffffffffffffffffffffffffffffffff94851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610991610500565b6040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281019190915260428101839052606201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015610a55573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590610ad057508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610b5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f546f6b656e577261707065643a3a7065726d69743a20496e76616c696420736960448201527f676e6174757265000000000000000000000000000000000000000000000000006064820152608401610669565b610b678a8a8a610b73565b50505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8316610c15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610cb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610df85781811015610deb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610669565b610df88484848403610b73565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610ea1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610f44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610ffa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610df8565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611098610430565b8051602091820120604080518082018252600181527f310000000000000000000000000000000000000000000000000000000000000090840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b73ffffffffffffffffffffffffffffffffffffffff82166111b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610669565b80600260008282546111c49190611629565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff82166112cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015611381576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610d1a565b600060208083528351808285015260005b81811015611411578581018301518582016040015282016113f5565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461147457600080fd5b919050565b6000806040838503121561148c57600080fd5b61149583611450565b946020939093013593505050565b6000806000606084860312156114b857600080fd5b6114c184611450565b92506114cf60208501611450565b9150604084013590509250925092565b6000602082840312156114f157600080fd5b6114fa82611450565b9392505050565b600080600080600080600060e0888a03121561151c57600080fd5b61152588611450565b965061153360208901611450565b95506040880135945060608801359350608088013560ff8116811461155757600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561158757600080fd5b61159083611450565b915061159e60208401611450565b90509250929050565b600181811c908216806115bb57607f821691505b6020821081036115f4577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156104d6576104d66115fa565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361166d5761166d6115fa565b506001019056fea26469706673582212208d88fee561cff7120d381c345cfc534cef8229a272dc5809d4bbb685ad67141164736f6c63430008110033a2646970667358221220addfd62f466d34ee002afbb4ae37b6be56ad421fe773f800badeb4ce1025089864736f6c63430008110033"
41
- },
42
- {
43
- "contractName": "PolygonZkEVMBridge proxy",
44
- "balance": "200000000000000000000000000",
45
- "nonce": "1",
46
- "address": "0xF6BEEeBB578e214CA9E23B0e9683454Ff88Ed2A7",
47
- "bytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461088b565b610135565b61006b6100a33660046108a6565b61017f565b3480156100b457600080fd5b506100bd6101f3565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461088b565b610231565b34801561011257600080fd5b506100bd61025e565b6101236102d4565b61013361012e6103ab565b6103b5565b565b61013d6103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481604051806020016040528060008152506000610419565b50565b61017461011b565b6101876103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101eb576101e68383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610419915050565b505050565b6101e661011b565b60006101fd6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103ab565b905090565b61022e61011b565b90565b6102396103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481610444565b60006102686103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103d9565b60606102b183836040518060600160405280602781526020016109bb602791396104a5565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6102dc6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b600061022161052a565b3660008037600080366000845af43d6000803e8080156103d4573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b61042283610552565b60008251118061042f5750805b156101e65761043e838361028c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61046d6103d9565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a16101748161059f565b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516104cf919061094d565b600060405180830381855af49150503d806000811461050a576040519150601f19603f3d011682016040523d82523d6000602084013e61050f565b606091505b5091509150610520868383876106ab565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103fd565b61055b81610753565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff8116610642576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103a2565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b6060831561074157825160000361073a5773ffffffffffffffffffffffffffffffffffffffff85163b61073a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103a2565b508161074b565b61074b838361081e565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff81163b6107f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016103a2565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610665565b81511561082e5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a29190610969565b803573ffffffffffffffffffffffffffffffffffffffff8116811461088657600080fd5b919050565b60006020828403121561089d57600080fd5b6102b182610862565b6000806000604084860312156108bb57600080fd5b6108c484610862565b9250602084013567ffffffffffffffff808211156108e157600080fd5b818601915086601f8301126108f557600080fd5b81358181111561090457600080fd5b87602082850101111561091657600080fd5b6020830194508093505050509250925092565b60005b8381101561094457818101518382015260200161092c565b50506000910152565b6000825161095f818460208701610929565b9190910192915050565b6020815260008251806020840152610988816040850160208701610929565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220a1af0d6cb4f1e31496a4c5c1448913bce4bd6ad3a39e47c6f7190c114d6f9bf464736f6c63430008110033",
48
- "storage": {
49
- "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000000000000000000000000000000000000000001",
50
- "0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000000001",
51
- "0x0000000000000000000000000000000000000000000000000000000000000068": "0x00000000000000a40d5f56745a118d0906a34e69aec8c0db1cb8fa0000000100",
52
- "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x00000000000000000000000040797c2f93298a44a893f43edf1b33b63d7ba333",
53
- "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x00000000000000000000000039e780d8800f7396e8b7530a8925b14025aedc77"
54
- }
55
- },
56
- {
57
- "contractName": "PolygonZkEVMGlobalExitRootL2 implementation",
58
- "balance": "0",
59
- "nonce": "1",
60
- "address": "0x77Fc57b154fCF8320Df2C2e6C044AA50141c023b",
61
- "bytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806301fd904414610051578063257b36321461006d57806333d6247d1461008d578063a3c573eb146100a2575b600080fd5b61005a60015481565b6040519081526020015b60405180910390f35b61005a61007b366004610162565b60006020819052908152604090205481565b6100a061009b366004610162565b6100ee565b005b6100c97f000000000000000000000000f6beeebb578e214ca9e23b0e9683454ff88ed2a781565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610064565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000f6beeebb578e214ca9e23b0e9683454ff88ed2a7161461015d576040517fb49365dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600155565b60006020828403121561017457600080fd5b503591905056fea2646970667358221220a187fc278346c1b61c449ea3641002b6eac2bda3351a122a12c35099f933696864736f6c63430008110033"
62
- },
63
- {
64
- "contractName": "PolygonZkEVMGlobalExitRootL2 proxy",
65
- "balance": "0",
66
- "nonce": "1",
67
- "address": "0xa40d5f56745a118d0906a34e69aec8c0db1cb8fa",
68
- "bytecode": "0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100855780635c60da1b146100985780638f283970146100c9578063f851a440146100e95761005d565b3661005d5761005b6100fe565b005b61005b6100fe565b34801561007157600080fd5b5061005b6100803660046106ca565b610118565b61005b6100933660046106e5565b61015f565b3480156100a457600080fd5b506100ad6101d0565b6040516001600160a01b03909116815260200160405180910390f35b3480156100d557600080fd5b5061005b6100e43660046106ca565b61020b565b3480156100f557600080fd5b506100ad610235565b610106610292565b610116610111610331565b61033b565b565b61012061035f565b6001600160a01b0316336001600160a01b031614156101575761015481604051806020016040528060008152506000610392565b50565b6101546100fe565b61016761035f565b6001600160a01b0316336001600160a01b031614156101c8576101c38383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610392915050565b505050565b6101c36100fe565b60006101da61035f565b6001600160a01b0316336001600160a01b03161415610200576101fb610331565b905090565b6102086100fe565b90565b61021361035f565b6001600160a01b0316336001600160a01b0316141561015757610154816103f1565b600061023f61035f565b6001600160a01b0316336001600160a01b03161415610200576101fb61035f565b606061028583836040518060600160405280602781526020016107e460279139610445565b9392505050565b3b151590565b61029a61035f565b6001600160a01b0316336001600160a01b031614156101165760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b60006101fb610519565b3660008037600080366000845af43d6000803e80801561035a573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b61039b83610541565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806103dc5750805b156101c3576103eb8383610260565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61041a61035f565b604080516001600160a01b03928316815291841660208301520160405180910390a1610154816105e9565b6060833b6104a45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610328565b600080856001600160a01b0316856040516104bf9190610794565b600060405180830381855af49150503d80600081146104fa576040519150601f19603f3d011682016040523d82523d6000602084013e6104ff565b606091505b509150915061050f828286610675565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610383565b803b6105a55760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610328565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b80546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b03811661064e5760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610328565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036105c8565b60608315610684575081610285565b8251156106945782518084602001fd5b8160405162461bcd60e51b815260040161032891906107b0565b80356001600160a01b03811681146106c557600080fd5b919050565b6000602082840312156106dc57600080fd5b610285826106ae565b6000806000604084860312156106fa57600080fd5b610703846106ae565b9250602084013567ffffffffffffffff8082111561072057600080fd5b818601915086601f83011261073457600080fd5b81358181111561074357600080fd5b87602082850101111561075557600080fd5b6020830194508093505050509250925092565b60005b8381101561078357818101518382015260200161076b565b838111156103eb5750506000910152565b600082516107a6818460208701610768565b9190910192915050565b60208152600082518060208401526107cf816040850160208701610768565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212204675187caf3a43285d9a2c1844a981e977bd52a85ff073e7fc649f73847d70a464736f6c63430008090033",
69
- "storage": {
70
- "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x00000000000000000000000040797c2f93298a44a893f43edf1b33b63d7ba333",
71
- "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x00000000000000000000000077fc57b154fcf8320df2c2e6c044aa50141c023b"
72
- }
73
- },
74
- {
75
- "contractName": "PolygonZkEVMTimelock",
76
- "balance": "0",
77
- "nonce": "1",
78
- "address": "0x02245d7B6CB0b6870d1e28AC877EE355b9588869",
79
- "bytecode": "0x6080604052600436106101c65760003560e01c806364d62353116100f7578063b1c5f42711610095578063d547741f11610064578063d547741f14610661578063e38335e514610681578063f23a6e6114610694578063f27a0c92146106d957600080fd5b8063b1c5f427146105af578063bc197c81146105cf578063c4d252f514610614578063d45c44351461063457600080fd5b80638f61f4f5116100d15780638f61f4f5146104e157806391d1485414610515578063a217fddf14610566578063b08e51c01461057b57600080fd5b806364d62353146104815780638065657f146104a15780638f2a0bb0146104c157600080fd5b8063248a9ca31161016457806331d507501161013e57806331d50750146103c857806336568abe146103e85780633a6aae7214610408578063584b153e1461046157600080fd5b8063248a9ca3146103475780632ab0f529146103775780632f2ff15d146103a857600080fd5b80630d3cf6fc116101a05780630d3cf6fc1461026b578063134008d31461029f57806313bc9f20146102b2578063150b7a02146102d257600080fd5b806301d5062a146101d257806301ffc9a7146101f457806307bd02651461022957600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed366004611c12565b6106ee565b005b34801561020057600080fd5b5061021461020f366004611c87565b610783565b60405190151581526020015b60405180910390f35b34801561023557600080fd5b5061025d7fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e6381565b604051908152602001610220565b34801561027757600080fd5b5061025d7f5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca581565b6101f26102ad366004611cc9565b6107df565b3480156102be57600080fd5b506102146102cd366004611d35565b6108d7565b3480156102de57600080fd5b506103166102ed366004611e5a565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610220565b34801561035357600080fd5b5061025d610362366004611d35565b60009081526020819052604090206001015490565b34801561038357600080fd5b50610214610392366004611d35565b6000908152600160208190526040909120541490565b3480156103b457600080fd5b506101f26103c3366004611ec2565b6108fd565b3480156103d457600080fd5b506102146103e3366004611d35565b610927565b3480156103f457600080fd5b506101f2610403366004611ec2565b610940565b34801561041457600080fd5b5061043c7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610220565b34801561046d57600080fd5b5061021461047c366004611d35565b6109f8565b34801561048d57600080fd5b506101f261049c366004611d35565b610a0e565b3480156104ad57600080fd5b5061025d6104bc366004611cc9565b610ade565b3480156104cd57600080fd5b506101f26104dc366004611f33565b610b1d565b3480156104ed57600080fd5b5061025d7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc181565b34801561052157600080fd5b50610214610530366004611ec2565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b34801561057257600080fd5b5061025d600081565b34801561058757600080fd5b5061025d7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f78381565b3480156105bb57600080fd5b5061025d6105ca366004611fe5565b610d4f565b3480156105db57600080fd5b506103166105ea36600461210e565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b34801561062057600080fd5b506101f261062f366004611d35565b610d94565b34801561064057600080fd5b5061025d61064f366004611d35565b60009081526001602052604090205490565b34801561066d57600080fd5b506101f261067c366004611ec2565b610e8f565b6101f261068f366004611fe5565b610eb4565b3480156106a057600080fd5b506103166106af3660046121b8565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b3480156106e557600080fd5b5061025d611161565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc161071881611204565b6000610728898989898989610ade565b90506107348184611211565b6000817f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8b8b8b8b8b8a60405161077096959493929190612266565b60405180910390a3505050505050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e00000000000000000000000000000000000000000000000000000000014806107d957506107d98261135e565b92915050565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff1661085c5761085c81336113f5565b600061086c888888888888610ade565b905061087881856114ad565b610884888888886115ea565b6000817fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588a8a8a8a6040516108bc94939291906122b1565b60405180910390a36108cd816116ee565b5050505050505050565b6000818152600160205260408120546001811180156108f65750428111155b9392505050565b60008281526020819052604090206001015461091881611204565b6109228383611797565b505050565b60008181526001602052604081205481905b1192915050565b73ffffffffffffffffffffffffffffffffffffffff811633146109ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6109f48282611887565b5050565b6000818152600160208190526040822054610939565b333014610a9d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f54696d656c6f636b436f6e74726f6c6c65723a2063616c6c6572206d7573742060448201527f62652074696d656c6f636b00000000000000000000000000000000000000000060648201526084016109e1565b60025460408051918252602082018390527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1600255565b6000868686868686604051602001610afb96959493929190612266565b6040516020818303038152906040528051906020012090509695505050505050565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1610b4781611204565b888714610bd6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b888514610c65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b6000610c778b8b8b8b8b8b8b8b610d4f565b9050610c838184611211565b60005b8a811015610d415780827f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8e8e85818110610cc357610cc36122f1565b9050602002016020810190610cd89190612320565b8d8d86818110610cea57610cea6122f1565b905060200201358c8c87818110610d0357610d036122f1565b9050602002810190610d15919061233b565b8c8b604051610d2996959493929190612266565b60405180910390a3610d3a816123cf565b9050610c86565b505050505050505050505050565b60008888888888888888604051602001610d709897969594939291906124b7565b60405160208183030381529060405280519060200120905098975050505050505050565b7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783610dbe81611204565b610dc7826109f8565b610e53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20636160448201527f6e6e6f742062652063616e63656c6c656400000000000000000000000000000060648201526084016109e1565b6000828152600160205260408082208290555183917fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb7091a25050565b600082815260208190526040902060010154610eaa81611204565b6109228383611887565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff16610f3157610f3181336113f5565b878614610fc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b87841461104f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b60006110618a8a8a8a8a8a8a8a610d4f565b905061106d81856114ad565b60005b8981101561114b5760008b8b8381811061108c5761108c6122f1565b90506020020160208101906110a19190612320565b905060008a8a848181106110b7576110b76122f1565b9050602002013590503660008a8a868181106110d5576110d56122f1565b90506020028101906110e7919061233b565b915091506110f7848484846115ea565b84867fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588686868660405161112e94939291906122b1565b60405180910390a35050505080611144906123cf565b9050611070565b50611155816116ee565b50505050505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166315064c966040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111f2919061257e565b156111fd5750600090565b5060025490565b61120e81336113f5565b50565b61121a82610927565b156112a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20616c60448201527f7265616479207363686564756c6564000000000000000000000000000000000060648201526084016109e1565b6112af611161565b81101561133e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a20696e73756666696369656e7460448201527f2064656c6179000000000000000000000000000000000000000000000000000060648201526084016109e1565b61134881426125a0565b6000928352600160205260409092209190915550565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806107d957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107d9565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f4576114338161193e565b61143e83602061195d565b60405160200161144f9291906125d7565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526109e191600401612658565b6114b6826108d7565b611542576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b80158061155e5750600081815260016020819052604090912054145b6109f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a206d697373696e67206465706560448201527f6e64656e6379000000000000000000000000000000000000000000000000000060648201526084016109e1565b60008473ffffffffffffffffffffffffffffffffffffffff168484846040516116149291906126a9565b60006040518083038185875af1925050503d8060008114611651576040519150601f19603f3d011682016040523d82523d6000602084013e611656565b606091505b50509050806116e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f54696d656c6f636b436f6e74726f6c6c65723a20756e6465726c79696e67207460448201527f72616e73616374696f6e2072657665727465640000000000000000000000000060648201526084016109e1565b5050505050565b6116f7816108d7565b611783576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b600090815260016020819052604090912055565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556118293390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606107d973ffffffffffffffffffffffffffffffffffffffff831660145b6060600061196c8360026126b9565b6119779060026125a0565b67ffffffffffffffff81111561198f5761198f611d4e565b6040519080825280601f01601f1916602001820160405280156119b9576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106119f0576119f06122f1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611a5357611a536122f1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611a8f8460026126b9565b611a9a9060016125a0565b90505b6001811115611b37577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611adb57611adb6122f1565b1a60f81b828281518110611af157611af16122f1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611b30816126d0565b9050611a9d565b5083156108f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109e1565b803573ffffffffffffffffffffffffffffffffffffffff81168114611bc457600080fd5b919050565b60008083601f840112611bdb57600080fd5b50813567ffffffffffffffff811115611bf357600080fd5b602083019150836020828501011115611c0b57600080fd5b9250929050565b600080600080600080600060c0888a031215611c2d57600080fd5b611c3688611ba0565b965060208801359550604088013567ffffffffffffffff811115611c5957600080fd5b611c658a828b01611bc9565b989b979a50986060810135976080820135975060a09091013595509350505050565b600060208284031215611c9957600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146108f657600080fd5b60008060008060008060a08789031215611ce257600080fd5b611ceb87611ba0565b955060208701359450604087013567ffffffffffffffff811115611d0e57600080fd5b611d1a89828a01611bc9565b979a9699509760608101359660809091013595509350505050565b600060208284031215611d4757600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611dc457611dc4611d4e565b604052919050565b600082601f830112611ddd57600080fd5b813567ffffffffffffffff811115611df757611df7611d4e565b611e2860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611d7d565b818152846020838601011115611e3d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215611e7057600080fd5b611e7985611ba0565b9350611e8760208601611ba0565b925060408501359150606085013567ffffffffffffffff811115611eaa57600080fd5b611eb687828801611dcc565b91505092959194509250565b60008060408385031215611ed557600080fd5b82359150611ee560208401611ba0565b90509250929050565b60008083601f840112611f0057600080fd5b50813567ffffffffffffffff811115611f1857600080fd5b6020830191508360208260051b8501011115611c0b57600080fd5b600080600080600080600080600060c08a8c031215611f5157600080fd5b893567ffffffffffffffff80821115611f6957600080fd5b611f758d838e01611eee565b909b50995060208c0135915080821115611f8e57600080fd5b611f9a8d838e01611eee565b909950975060408c0135915080821115611fb357600080fd5b50611fc08c828d01611eee565b9a9d999c50979a969997986060880135976080810135975060a0013595509350505050565b60008060008060008060008060a0898b03121561200157600080fd5b883567ffffffffffffffff8082111561201957600080fd5b6120258c838d01611eee565b909a50985060208b013591508082111561203e57600080fd5b61204a8c838d01611eee565b909850965060408b013591508082111561206357600080fd5b506120708b828c01611eee565b999c989b509699959896976060870135966080013595509350505050565b600082601f83011261209f57600080fd5b8135602067ffffffffffffffff8211156120bb576120bb611d4e565b8160051b6120ca828201611d7d565b92835284810182019282810190878511156120e457600080fd5b83870192505b84831015612103578235825291830191908301906120ea565b979650505050505050565b600080600080600060a0868803121561212657600080fd5b61212f86611ba0565b945061213d60208701611ba0565b9350604086013567ffffffffffffffff8082111561215a57600080fd5b61216689838a0161208e565b9450606088013591508082111561217c57600080fd5b61218889838a0161208e565b9350608088013591508082111561219e57600080fd5b506121ab88828901611dcc565b9150509295509295909350565b600080600080600060a086880312156121d057600080fd5b6121d986611ba0565b94506121e760208701611ba0565b93506040860135925060608601359150608086013567ffffffffffffffff81111561221157600080fd5b6121ab88828901611dcc565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b73ffffffffffffffffffffffffffffffffffffffff8716815285602082015260a06040820152600061229c60a08301868861221d565b60608301949094525060800152949350505050565b73ffffffffffffffffffffffffffffffffffffffff851681528360208201526060604082015260006122e760608301848661221d565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561233257600080fd5b6108f682611ba0565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261237057600080fd5b83018035915067ffffffffffffffff82111561238b57600080fd5b602001915036819003821315611c0b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612400576124006123a0565b5060010190565b81835260006020808501808196508560051b810191508460005b878110156124aa57828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe188360301811261246057600080fd5b8701858101903567ffffffffffffffff81111561247c57600080fd5b80360382131561248b57600080fd5b61249686828461221d565b9a87019a9550505090840190600101612421565b5091979650505050505050565b60a0808252810188905260008960c08301825b8b8110156125055773ffffffffffffffffffffffffffffffffffffffff6124f084611ba0565b168252602092830192909101906001016124ca565b5083810360208501528881527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff89111561253e57600080fd5b8860051b9150818a602083013701828103602090810160408501526125669082018789612407565b60608401959095525050608001529695505050505050565b60006020828403121561259057600080fd5b815180151581146108f657600080fd5b808201808211156107d9576107d96123a0565b60005b838110156125ce5781810151838201526020016125b6565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161260f8160178501602088016125b3565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161264c8160288401602088016125b3565b01602801949350505050565b60208152600082518060208401526126778160408501602087016125b3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b8183823760009101908152919050565b80820281158282048414176107d9576107d96123a0565b6000816126df576126df6123a0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea2646970667358221220288c3dd40a2ba96edf066502722584177809ebdb47c0cf9ee8df6f07954c373064736f6c63430008110033",
80
- "storage": {
81
- "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000015180",
82
- "0xbdd73c6ebfb442c137537be0985acf11af8e6133078bc51ef9094071cb0ca475": "0x0000000000000000000000000000000000000000000000000000000000000001",
83
- "0x92b79801e6a3d148a516c908cc0bbad93771fa74468b7757a14aa55532d092de": "0x0000000000000000000000000000000000000000000000000000000000000001",
84
- "0x64494413541ff93b31aa309254e3fed72a7456e9845988b915b4c7a7ceba8814": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5",
85
- "0x43e090632490f7d46c400129311fff008a7688bb3d4aebdf80607456b452cf04": "0x0000000000000000000000000000000000000000000000000000000000000001",
86
- "0x3412d5605ac6cd444957cedb533e5dacad6378b4bc819ebe3652188a665066d6": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5",
87
- "0x5af21cf0316499c6925cf9be0331b8bd150a1fa4c19d24a043b45f0cf15357c3": "0x0000000000000000000000000000000000000000000000000000000000000001",
88
- "0xdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d706a": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5",
89
- "0xaf021eeb38644155cd697b3ce0ec4fdac818d29c448a9f9d9bafc293723c6cd8": "0x0000000000000000000000000000000000000000000000000000000000000001",
90
- "0xc3ad33e20b0c56a223ad5104fff154aa010f8715b9c981fd38fdc60a4d1a52fc": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5"
91
- }
92
- },
93
- {
94
- "accountName": "keyless Deployer",
95
- "balance": "0",
96
- "nonce": "1",
97
- "address": "0xB83a574B3966F7dc1d38d162FA154F2A57D608Bb"
98
- },
99
- {
100
- "accountName": "deployer",
101
- "balance": "0",
102
- "nonce": "8",
103
- "address": "0xA0B02B28920812324f1cC3255bd8840867d3f227"
104
- }
105
- ]
106
- }
107
-
108
- `
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
{/home/stefan/go/src/Polygon/zkevm-node → .}/config/types/duration.go RENAMED
@@ -38,3 +38,13 @@
38
  },
39
  }
40
  }
 
 
 
 
 
 
 
 
 
 
 
38
  },
39
  }
40
  }
41
+
42
+ // MarshalJSON marshalls time duration into text.
43
+ func (d Duration) MarshalJSON() ([]byte, error) {
44
+ return []byte(`"` + d.String() + `"`), nil
45
+ }
46
+
47
+ // MarshalText marshalls time duration into text.
48
+ func (d *Duration) MarshalText() ([]byte, error) {
49
+ return []byte(d.String()), nil
50
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/config.go RENAMED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ package dataavailability
2
+
3
+ // DABackendType is the data availability protocol for the CDK
4
+ type DABackendType string
5
+
6
+ const (
7
+ // DataAvailabilityCommittee is the DAC protocol backend
8
+ DataAvailabilityCommittee DABackendType = "DataAvailabilityCommittee"
9
+ )
{/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/dataavailability.go RENAMED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package dataavailability
2
+
3
+ import (
4
+ "context"
5
+ "errors"
6
+ "fmt"
7
+ "math/big"
8
+
9
+ "github.com/0xPolygonHermez/zkevm-node/etherman/types"
10
+ jsontypes "github.com/0xPolygonHermez/zkevm-node/jsonrpc/types"
11
+ "github.com/0xPolygonHermez/zkevm-node/log"
12
+ "github.com/ethereum/go-ethereum/common"
13
+ "github.com/ethereum/go-ethereum/crypto"
14
+ )
15
+
16
+ const (
17
+ unexpectedHashTemplate = "mismatch on transaction data for batch num %d. Expected hash %s, actual hash: %s"
18
+ failedDataRetrievalTemplate = "failed to retrieve local data for batches %v: %s"
19
+ invalidBatchRetrievalArgs = "invalid L2 batch data retrieval arguments, %d != %d"
20
+ )
21
+
22
+ // DataSourcePriority defines where data is retrieved from
23
+ type DataSourcePriority string
24
+
25
+ const (
26
+ // Local indicates data stored in this nodes DB
27
+ Local DataSourcePriority = "local"
28
+ // Trusted indicates data stored in the Trusted Sequencer
29
+ Trusted DataSourcePriority = "trusted"
30
+ // External indicates data stored in the Data Availability layer
31
+ External DataSourcePriority = "external"
32
+ )
33
+
34
+ // DefaultPriority is the default order in which data is retrieved
35
+ var DefaultPriority = []DataSourcePriority{Local, Trusted, External}
36
+
37
+ // DataAvailability implements an abstract data availability integration
38
+ type DataAvailability struct {
39
+ isTrustedSequencer bool
40
+ state stateInterface
41
+ zkEVMClient ZKEVMClientTrustedBatchesGetter
42
+ backend DABackender
43
+ dataSourcePriority []DataSourcePriority
44
+ ctx context.Context
45
+ }
46
+
47
+ // New creates a DataAvailability instance
48
+ func New(
49
+ isTrustedSequencer bool,
50
+ backend DABackender,
51
+ state stateInterface,
52
+ zkEVMClient ZKEVMClientTrustedBatchesGetter,
53
+ priority []DataSourcePriority,
54
+ ) (*DataAvailability, error) {
55
+ da := &DataAvailability{
56
+ isTrustedSequencer: isTrustedSequencer,
57
+ backend: backend,
58
+ state: state,
59
+ zkEVMClient: zkEVMClient,
60
+ ctx: context.Background(),
61
+ dataSourcePriority: priority,
62
+ }
63
+ if len(da.dataSourcePriority) == 0 {
64
+ da.dataSourcePriority = DefaultPriority
65
+ }
66
+ err := da.backend.Init()
67
+ return da, err
68
+ }
69
+
70
+ // PostSequence sends the sequence data to the data availability backend, and returns the dataAvailabilityMessage
71
+ // as expected by the contract
72
+ func (d *DataAvailability) PostSequence(ctx context.Context, sequences []types.Sequence) ([]byte, error) {
73
+ batchesData := [][]byte{}
74
+ for _, batch := range sequences {
75
+ // Do not send to the DA backend data that will be stored to L1
76
+ if batch.ForcedBatchTimestamp == 0 {
77
+ batchesData = append(batchesData, batch.BatchL2Data)
78
+ }
79
+ }
80
+ return d.backend.PostSequence(ctx, batchesData)
81
+ }
82
+
83
+ // GetBatchL2Data tries to return the data from a batch, in the following priorities. batchNums should not include forced batches.
84
+ // 1. From local DB
85
+ // 2. From Trusted Sequencer (if not self)
86
+ // 3. From DA backend
87
+ func (d *DataAvailability) GetBatchL2Data(batchNums []uint64, batchHashes []common.Hash, dataAvailabilityMessage []byte) ([][]byte, error) {
88
+ if len(batchNums) != len(batchHashes) {
89
+ return nil, fmt.Errorf(invalidBatchRetrievalArgs, len(batchNums), len(batchHashes))
90
+ }
91
+
92
+ for _, p := range d.dataSourcePriority {
93
+ switch p {
94
+ case Local:
95
+ localData, err := d.state.GetBatchL2DataByNumbers(d.ctx, batchNums, nil)
96
+ if err != nil {
97
+ return nil, err
98
+ }
99
+
100
+ data, err := checkBatches(batchNums, batchHashes, localData)
101
+ if err != nil {
102
+ log.Warnf(failedDataRetrievalTemplate, batchNums, err.Error())
103
+ } else {
104
+ return data, nil
105
+ }
106
+ case Trusted:
107
+ if !d.isTrustedSequencer {
108
+ data, err := d.rpcData(batchNums, batchHashes, d.zkEVMClient.BatchesByNumbers)
109
+ if err != nil {
110
+ log.Warnf(failedDataRetrievalTemplate, batchNums, err.Error())
111
+ } else {
112
+ return data, nil
113
+ }
114
+ }
115
+ case External:
116
+ return d.backend.GetSequence(d.ctx, batchHashes, dataAvailabilityMessage)
117
+ default:
118
+ log.Warnf("invalid data retrieval priority: %s", p)
119
+ }
120
+ }
121
+
122
+ return nil, errors.New("failed to retrieve l2 batch data")
123
+ }
124
+
125
+ func checkBatches(batchNumbers []uint64, expectedHashes []common.Hash, batchData map[uint64][]byte) ([][]byte, error) {
126
+ if len(batchNumbers) != len(expectedHashes) {
127
+ return nil, fmt.Errorf("invalid batch parameters")
128
+ }
129
+ result := make([][]byte, len(batchNumbers))
130
+ for i := 0; i < len(batchNumbers); i++ {
131
+ batchNumber := batchNumbers[i]
132
+ expectedHash := expectedHashes[i]
133
+ bd, ok := batchData[batchNumber]
134
+ if !ok {
135
+ return nil, fmt.Errorf("missing batch data: [%d] %s", batchNumber, expectedHash.Hex())
136
+ }
137
+ actualHash := crypto.Keccak256Hash(bd)
138
+ if actualHash != expectedHash {
139
+ err := fmt.Errorf(unexpectedHashTemplate, batchNumber, expectedHash, actualHash)
140
+ log.Warnf("wrong local data for hash: %s", err.Error())
141
+ return nil, err
142
+ }
143
+ result[i] = bd
144
+ }
145
+ return result, nil
146
+ }
147
+
148
+ type rpcBatchDataFunc func(ctx context.Context, numbers []*big.Int) ([]*jsontypes.BatchData, error)
149
+
150
+ // rpcData retrieves batch data from rpcBatchDataFunc, returns an error unless all are found and correct
151
+ func (d *DataAvailability) rpcData(batchNums []uint64, expectedHashes []common.Hash, rpcFunc rpcBatchDataFunc) ([][]byte, error) {
152
+ if len(batchNums) != len(expectedHashes) {
153
+ return nil, fmt.Errorf("invalid arguments, len of batch numbers does not equal length of expected hashes: %d != %d",
154
+ len(batchNums), len(expectedHashes))
155
+ }
156
+ nums := make([]*big.Int, 0, len(batchNums))
157
+ for _, n := range batchNums {
158
+ nums = append(nums, new(big.Int).SetUint64(n))
159
+ }
160
+ batchData, err := rpcFunc(d.ctx, nums)
161
+ if err != nil {
162
+ return nil, err
163
+ }
164
+ if len(batchData) != len(batchNums) {
165
+ return nil, fmt.Errorf("missing batch data, expected %d, got %d", len(batchNums), len(batchData))
166
+ }
167
+ result := make(map[uint64][]byte)
168
+ for i := 0; i < len(batchNums); i++ {
169
+ number := batchNums[i]
170
+ batch := batchData[i]
171
+ expectedTransactionsHash := expectedHashes[i]
172
+ actualTransactionsHash := crypto.Keccak256Hash(batch.BatchL2Data)
173
+ if expectedTransactionsHash != actualTransactionsHash {
174
+ return nil, fmt.Errorf(unexpectedHashTemplate, number, expectedTransactionsHash, actualTransactionsHash)
175
+ }
176
+ result[number] = batch.BatchL2Data
177
+ }
178
+ checked, err := checkBatches(batchNums, expectedHashes, result)
179
+ if err != nil {
180
+ return nil, err
181
+ }
182
+ return checked, nil
183
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/datacommittee/datacommittee.go RENAMED
@@ -0,0 +1,309 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package datacommittee
2
+
3
+ import (
4
+ "crypto/ecdsa"
5
+ "errors"
6
+ "fmt"
7
+ "math/big"
8
+ "math/rand"
9
+ "sort"
10
+ "strings"
11
+
12
+ "github.com/0xPolygon/cdk-data-availability/client"
13
+ daTypes "github.com/0xPolygon/cdk-data-availability/types"
14
+ "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygondatacommittee"
15
+ "github.com/0xPolygonHermez/zkevm-node/log"
16
+ "github.com/ethereum/go-ethereum/accounts/abi/bind"
17
+ "github.com/ethereum/go-ethereum/common"
18
+ "github.com/ethereum/go-ethereum/crypto"
19
+ "github.com/ethereum/go-ethereum/ethclient"
20
+ "golang.org/x/net/context"
21
+ )
22
+
23
+ const unexpectedHashTemplate = "missmatch on transaction data. Expected hash %s, actual hash: %s"
24
+
25
+ // DataCommitteeMember represents a member of the Data Committee
26
+ type DataCommitteeMember struct {
27
+ Addr common.Address
28
+ URL string
29
+ }
30
+
31
+ // DataCommittee represents a specific committee
32
+ type DataCommittee struct {
33
+ AddressesHash common.Hash
34
+ Members []DataCommitteeMember
35
+ RequiredSignatures uint64
36
+ }
37
+
38
+ // DataCommitteeBackend implements the DAC integration
39
+ type DataCommitteeBackend struct {
40
+ dataCommitteeContract *polygondatacommittee.Polygondatacommittee
41
+ privKey *ecdsa.PrivateKey
42
+ dataCommitteeClientFactory client.Factory
43
+
44
+ committeeMembers []DataCommitteeMember
45
+ selectedCommitteeMember int
46
+ ctx context.Context
47
+ }
48
+
49
+ // New creates an instance of DataCommitteeBackend
50
+ func New(
51
+ l1RPCURL string,
52
+ dataCommitteeAddr common.Address,
53
+ privKey *ecdsa.PrivateKey,
54
+ dataCommitteeClientFactory client.Factory,
55
+ ) (*DataCommitteeBackend, error) {
56
+ ethClient, err := ethclient.Dial(l1RPCURL)
57
+ if err != nil {
58
+ log.Errorf("error connecting to %s: %+v", l1RPCURL, err)
59
+ return nil, err
60
+ }
61
+ dataCommittee, err := polygondatacommittee.NewPolygondatacommittee(dataCommitteeAddr, ethClient)
62
+ if err != nil {
63
+ return nil, err
64
+ }
65
+ return &DataCommitteeBackend{
66
+ dataCommitteeContract: dataCommittee,
67
+ privKey: privKey,
68
+ dataCommitteeClientFactory: dataCommitteeClientFactory,
69
+ ctx: context.Background(),
70
+ }, nil
71
+ }
72
+
73
+ // Init loads the DAC to be cached when needed
74
+ func (d *DataCommitteeBackend) Init() error {
75
+ committee, err := d.getCurrentDataCommittee()
76
+ if err != nil {
77
+ return err
78
+ }
79
+ selectedCommitteeMember := -1
80
+ if committee != nil {
81
+ d.committeeMembers = committee.Members
82
+ if len(committee.Members) > 0 {
83
+ selectedCommitteeMember = rand.Intn(len(committee.Members)) //nolint:gosec
84
+ }
85
+ }
86
+ d.selectedCommitteeMember = selectedCommitteeMember
87
+ return nil
88
+ }
89
+
90
+ // GetSequence gets backend data one hash at a time. This should be optimized on the DAC side to get them all at once.
91
+ func (d *DataCommitteeBackend) GetSequence(ctx context.Context, hashes []common.Hash, dataAvailabilityMessage []byte) ([][]byte, error) {
92
+ // TODO: optimize this on the DAC side by implementing a multi batch retrieve api
93
+ var batchData [][]byte
94
+ for _, h := range hashes {
95
+ data, err := d.GetBatchL2Data(h)
96
+ if err != nil {
97
+ return nil, err
98
+ }
99
+ batchData = append(batchData, data)
100
+ }
101
+ return batchData, nil
102
+ }
103
+
104
+ // GetBatchL2Data returns the data from the DAC. It checks that it matches with the expected hash
105
+ func (d *DataCommitteeBackend) GetBatchL2Data(hash common.Hash) ([]byte, error) {
106
+ intialMember := d.selectedCommitteeMember
107
+ found := false
108
+ for !found && intialMember != -1 {
109
+ member := d.committeeMembers[d.selectedCommitteeMember]
110
+ log.Infof("trying to get data from %s at %s", member.Addr.Hex(), member.URL)
111
+ c := d.dataCommitteeClientFactory.New(member.URL)
112
+ data, err := c.GetOffChainData(d.ctx, hash)
113
+ if err != nil {
114
+ log.Warnf(
115
+ "error getting data from DAC node %s at %s: %s",
116
+ member.Addr.Hex(), member.URL, err,
117
+ )
118
+ d.selectedCommitteeMember = (d.selectedCommitteeMember + 1) % len(d.committeeMembers)
119
+ if d.selectedCommitteeMember == intialMember {
120
+ break
121
+ }
122
+ continue
123
+ }
124
+ actualTransactionsHash := crypto.Keccak256Hash(data)
125
+ if actualTransactionsHash != hash {
126
+ unexpectedHash := fmt.Errorf(
127
+ unexpectedHashTemplate, hash, actualTransactionsHash,
128
+ )
129
+ log.Warnf(
130
+ "error getting data from DAC node %s at %s: %s",
131
+ member.Addr.Hex(), member.URL, unexpectedHash,
132
+ )
133
+ d.selectedCommitteeMember = (d.selectedCommitteeMember + 1) % len(d.committeeMembers)
134
+ if d.selectedCommitteeMember == intialMember {
135
+ break
136
+ }
137
+ continue
138
+ }
139
+ return data, nil
140
+ }
141
+ if err := d.Init(); err != nil {
142
+ return nil, fmt.Errorf("error loading data committee: %s", err)
143
+ }
144
+ return nil, fmt.Errorf("couldn't get the data from any committee member")
145
+ }
146
+
147
+ type signatureMsg struct {
148
+ addr common.Address
149
+ signature []byte
150
+ err error
151
+ }
152
+
153
+ // PostSequence sends the sequence data to the data availability backend, and returns the dataAvailabilityMessage
154
+ // as expected by the contract
155
+ func (s *DataCommitteeBackend) PostSequence(ctx context.Context, batchesData [][]byte) ([]byte, error) {
156
+ // Get current committee
157
+ committee, err := s.getCurrentDataCommittee()
158
+ if err != nil {
159
+ return nil, err
160
+ }
161
+
162
+ // Authenticate as trusted sequencer by signing the sequences
163
+ sequence := daTypes.Sequence{}
164
+ for _, seq := range batchesData {
165
+ sequence = append(sequence, seq)
166
+ }
167
+ signedSequence, err := sequence.Sign(s.privKey)
168
+ if err != nil {
169
+ return nil, err
170
+ }
171
+
172
+ // Request signatures to all members in parallel
173
+ ch := make(chan signatureMsg, len(committee.Members))
174
+ signatureCtx, cancelSignatureCollection := context.WithCancel(ctx)
175
+ for _, member := range committee.Members {
176
+ go requestSignatureFromMember(signatureCtx, *signedSequence, member, ch)
177
+ }
178
+
179
+ // Collect signatures
180
+ msgs := []signatureMsg{}
181
+ var (
182
+ collectedSignatures uint64
183
+ failedToCollect uint64
184
+ )
185
+ for collectedSignatures < committee.RequiredSignatures {
186
+ msg := <-ch
187
+ if msg.err != nil {
188
+ log.Errorf("error when trying to get signature from %s: %s", msg.addr, msg.err)
189
+ failedToCollect++
190
+ if len(committee.Members)-int(failedToCollect) < int(committee.RequiredSignatures) {
191
+ cancelSignatureCollection()
192
+ return nil, errors.New("too many members failed to send their signature")
193
+ }
194
+ } else {
195
+ log.Infof("received signature from %s", msg.addr)
196
+ collectedSignatures++
197
+ }
198
+ msgs = append(msgs, msg)
199
+ }
200
+
201
+ // Stop requesting as soon as we have N valid signatures
202
+ cancelSignatureCollection()
203
+
204
+ return buildSignaturesAndAddrs(signatureMsgs(msgs), committee.Members), nil
205
+ }
206
+
207
+ func requestSignatureFromMember(ctx context.Context, signedSequence daTypes.SignedSequence, member DataCommitteeMember, ch chan signatureMsg) {
208
+ // request
209
+ c := client.New(member.URL)
210
+ log.Infof("sending request to sign the sequence to %s at %s", member.Addr.Hex(), member.URL)
211
+ signature, err := c.SignSequence(signedSequence)
212
+ if err != nil {
213
+ ch <- signatureMsg{
214
+ addr: member.Addr,
215
+ err: err,
216
+ }
217
+ return
218
+ }
219
+ // verify returned signature
220
+ signedSequence.Signature = signature
221
+ signer, err := signedSequence.Signer()
222
+ if err != nil {
223
+ ch <- signatureMsg{
224
+ addr: member.Addr,
225
+ err: err,
226
+ }
227
+ return
228
+ }
229
+ if signer != member.Addr {
230
+ ch <- signatureMsg{
231
+ addr: member.Addr,
232
+ err: fmt.Errorf("invalid signer. Expected %s, actual %s", member.Addr.Hex(), signer.Hex()),
233
+ }
234
+ return
235
+ }
236
+ ch <- signatureMsg{
237
+ addr: member.Addr,
238
+ signature: signature,
239
+ }
240
+ }
241
+
242
+ func buildSignaturesAndAddrs(sigs signatureMsgs, members []DataCommitteeMember) []byte {
243
+ const (
244
+ sigLen = 65
245
+ addrLen = 20
246
+ )
247
+ res := make([]byte, 0, len(sigs)*sigLen+len(members)*addrLen)
248
+ sort.Sort(sigs)
249
+ for _, msg := range sigs {
250
+ log.Debugf("adding signature %s from %s", common.Bytes2Hex(msg.signature), msg.addr.Hex())
251
+ res = append(res, msg.signature...)
252
+ }
253
+ for _, member := range members {
254
+ log.Debugf("adding addr %s", common.Bytes2Hex(member.Addr.Bytes()))
255
+ res = append(res, member.Addr.Bytes()...)
256
+ }
257
+ log.Debugf("full res %s", common.Bytes2Hex(res))
258
+ return res
259
+ }
260
+
261
+ type signatureMsgs []signatureMsg
262
+
263
+ func (s signatureMsgs) Len() int { return len(s) }
264
+ func (s signatureMsgs) Less(i, j int) bool {
265
+ return strings.ToUpper(s[i].addr.Hex()) < strings.ToUpper(s[j].addr.Hex())
266
+ }
267
+ func (s signatureMsgs) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
268
+
269
+ // getCurrentDataCommittee return the currently registered data committee
270
+ func (d *DataCommitteeBackend) getCurrentDataCommittee() (*DataCommittee, error) {
271
+ addrsHash, err := d.dataCommitteeContract.CommitteeHash(&bind.CallOpts{Pending: false})
272
+ if err != nil {
273
+ return nil, fmt.Errorf("error getting CommitteeHash from L1 SC: %w", err)
274
+ }
275
+ reqSign, err := d.dataCommitteeContract.RequiredAmountOfSignatures(&bind.CallOpts{Pending: false})
276
+ if err != nil {
277
+ return nil, fmt.Errorf("error getting RequiredAmountOfSignatures from L1 SC: %w", err)
278
+ }
279
+ members, err := d.getCurrentDataCommitteeMembers()
280
+ if err != nil {
281
+ return nil, err
282
+ }
283
+
284
+ return &DataCommittee{
285
+ AddressesHash: common.Hash(addrsHash),
286
+ RequiredSignatures: reqSign.Uint64(),
287
+ Members: members,
288
+ }, nil
289
+ }
290
+
291
+ // getCurrentDataCommitteeMembers return the currently registered data committee members
292
+ func (d *DataCommitteeBackend) getCurrentDataCommitteeMembers() ([]DataCommitteeMember, error) {
293
+ nMembers, err := d.dataCommitteeContract.GetAmountOfMembers(&bind.CallOpts{Pending: false})
294
+ if err != nil {
295
+ return nil, fmt.Errorf("error getting GetAmountOfMembers from L1 SC: %w", err)
296
+ }
297
+ members := make([]DataCommitteeMember, 0, nMembers.Int64())
298
+ for i := int64(0); i < nMembers.Int64(); i++ {
299
+ member, err := d.dataCommitteeContract.Members(&bind.CallOpts{Pending: false}, big.NewInt(i))
300
+ if err != nil {
301
+ return nil, fmt.Errorf("error getting Members %d from L1 SC: %w", i, err)
302
+ }
303
+ members = append(members, DataCommitteeMember{
304
+ Addr: member.Addr,
305
+ URL: member.Url,
306
+ })
307
+ }
308
+ return members, nil
309
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/datacommittee/datacommittee_test.go RENAMED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package datacommittee
2
+
3
+ import (
4
+ "math/big"
5
+ "testing"
6
+
7
+ "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygondatacommittee"
8
+ "github.com/0xPolygonHermez/zkevm-node/log"
9
+ "github.com/ethereum/go-ethereum/accounts/abi/bind"
10
+ "github.com/ethereum/go-ethereum/common"
11
+ "github.com/ethereum/go-ethereum/core"
12
+ "github.com/ethereum/go-ethereum/crypto"
13
+ "github.com/ethereum/go-ethereum/ethclient/simulated"
14
+ "github.com/stretchr/testify/assert"
15
+ "github.com/stretchr/testify/require"
16
+ )
17
+
18
+ func TestUpdateDataCommitteeEvent(t *testing.T) {
19
+ // Set up testing environment
20
+ dac, ethBackend, auth, da := newTestingEnv(t)
21
+
22
+ // Update the committee
23
+ requiredAmountOfSignatures := big.NewInt(2)
24
+ URLs := []string{"1", "2", "3"}
25
+ addrs := []common.Address{
26
+ common.HexToAddress("0x1"),
27
+ common.HexToAddress("0x2"),
28
+ common.HexToAddress("0x3"),
29
+ }
30
+ addrsBytes := []byte{}
31
+ for _, addr := range addrs {
32
+ addrsBytes = append(addrsBytes, addr.Bytes()...)
33
+ }
34
+ _, err := da.SetupCommittee(auth, requiredAmountOfSignatures, URLs, addrsBytes)
35
+ require.NoError(t, err)
36
+ ethBackend.Commit()
37
+
38
+ // Assert the committee update
39
+ actualSetup, err := dac.getCurrentDataCommittee()
40
+ require.NoError(t, err)
41
+ expectedMembers := []DataCommitteeMember{}
42
+ expectedSetup := DataCommittee{
43
+ RequiredSignatures: uint64(len(URLs) - 1),
44
+ AddressesHash: crypto.Keccak256Hash(addrsBytes),
45
+ }
46
+ for i, url := range URLs {
47
+ expectedMembers = append(expectedMembers, DataCommitteeMember{
48
+ URL: url,
49
+ Addr: addrs[i],
50
+ })
51
+ }
52
+ expectedSetup.Members = expectedMembers
53
+ assert.Equal(t, expectedSetup, *actualSetup)
54
+ }
55
+
56
+ func init() {
57
+ log.Init(log.Config{
58
+ Level: "debug",
59
+ Outputs: []string{"stderr"},
60
+ })
61
+ }
62
+
63
+ // This function prepare the blockchain, the wallet with funds and deploy the smc
64
+ func newTestingEnv(t *testing.T) (
65
+ dac *DataCommitteeBackend,
66
+ ethBackend *simulated.Backend,
67
+ auth *bind.TransactOpts,
68
+ da *polygondatacommittee.Polygondatacommittee,
69
+ ) {
70
+ t.Helper()
71
+ privateKey, err := crypto.GenerateKey()
72
+ if err != nil {
73
+ log.Fatal(err)
74
+ }
75
+ auth, err = bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(1337))
76
+ if err != nil {
77
+ log.Fatal(err)
78
+ }
79
+ dac, ethBackend, da, err = newSimulatedDacman(t, auth)
80
+ if err != nil {
81
+ log.Fatal(err)
82
+ }
83
+ return dac, ethBackend, auth, da
84
+ }
85
+
86
+ // NewSimulatedEtherman creates an etherman that uses a simulated blockchain. It's important to notice that the ChainID of the auth
87
+ // must be 1337. The address that holds the auth will have an initial balance of 10 ETH
88
+ func newSimulatedDacman(t *testing.T, auth *bind.TransactOpts) (
89
+ dacman *DataCommitteeBackend,
90
+ ethBackend *simulated.Backend,
91
+ da *polygondatacommittee.Polygondatacommittee,
92
+ err error,
93
+ ) {
94
+ t.Helper()
95
+ if auth == nil {
96
+ // read only client
97
+ return &DataCommitteeBackend{}, nil, nil, nil
98
+ }
99
+ // 10000000 ETH in wei
100
+ balance, _ := new(big.Int).SetString("10000000000000000000000000", 10) //nolint:gomnd
101
+ address := auth.From
102
+ genesisAlloc := map[common.Address]core.GenesisAccount{
103
+ address: {
104
+ Balance: balance,
105
+ },
106
+ }
107
+ blockGasLimit := uint64(999999999999999999) //nolint:gomnd
108
+ client := simulated.NewBackend(genesisAlloc, simulated.WithBlockGasLimit(blockGasLimit))
109
+
110
+ // DAC Setup
111
+ _, _, da, err = polygondatacommittee.DeployPolygondatacommittee(auth, client.Client())
112
+ if err != nil {
113
+ return &DataCommitteeBackend{}, nil, nil, err
114
+ }
115
+ client.Commit()
116
+ _, err = da.Initialize(auth)
117
+ if err != nil {
118
+ return &DataCommitteeBackend{}, nil, nil, err
119
+ }
120
+ client.Commit()
121
+ _, err = da.SetupCommittee(auth, big.NewInt(0), []string{}, []byte{})
122
+ if err != nil {
123
+ return &DataCommitteeBackend{}, nil, nil, err
124
+ }
125
+ client.Commit()
126
+
127
+ c := &DataCommitteeBackend{
128
+ dataCommitteeContract: da,
129
+ }
130
+ return c, client, da, nil
131
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/interfaces.go RENAMED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package dataavailability
2
+
3
+ import (
4
+ "context"
5
+ "math/big"
6
+
7
+ "github.com/0xPolygonHermez/zkevm-node/jsonrpc/types"
8
+ "github.com/0xPolygonHermez/zkevm-node/state"
9
+ "github.com/ethereum/go-ethereum/common"
10
+ "github.com/jackc/pgx/v4"
11
+ )
12
+
13
+ // DABackender is an interface for components that store and retrieve batch data
14
+ type DABackender interface {
15
+ SequenceRetriever
16
+ SequenceSender
17
+ // Init initializes the DABackend
18
+ Init() error
19
+ }
20
+
21
+ // SequenceSender is used to send provided sequence of batches
22
+ type SequenceSender interface {
23
+ // PostSequence sends the sequence data to the data availability backend, and returns the dataAvailabilityMessage
24
+ // as expected by the contract
25
+ PostSequence(ctx context.Context, batchesData [][]byte) ([]byte, error)
26
+ }
27
+
28
+ // SequenceRetriever is used to retrieve batch data
29
+ type SequenceRetriever interface {
30
+ // GetSequence retrieves the sequence data from the data availability backend
31
+ GetSequence(ctx context.Context, batchHashes []common.Hash, dataAvailabilityMessage []byte) ([][]byte, error)
32
+ }
33
+
34
+ // === Internal interfaces ===
35
+
36
+ type stateInterface interface {
37
+ GetBatchL2DataByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) ([]byte, error)
38
+ GetBatchL2DataByNumbers(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error)
39
+ GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error)
40
+ GetForcedBatchDataByNumbers(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error)
41
+ }
42
+
43
+ // BatchDataProvider is used to retrieve batch data
44
+ type BatchDataProvider interface {
45
+ // GetBatchL2Data retrieve the data of a batch from the DA backend. The returned data must be the pre-image of the hash
46
+ GetBatchL2Data(batchNum []uint64, batchHashes []common.Hash, dataAvailabilityMessage []byte) ([][]byte, error)
47
+ }
48
+
49
+ // DataManager is an interface for components that send and retrieve batch data
50
+ type DataManager interface {
51
+ BatchDataProvider
52
+ SequenceSender
53
+ }
54
+
55
+ // ZKEVMClientTrustedBatchesGetter contains the methods required to interact with zkEVM-RPC
56
+ type ZKEVMClientTrustedBatchesGetter interface {
57
+ BatchByNumber(ctx context.Context, number *big.Int) (*types.Batch, error)
58
+ BatchesByNumbers(ctx context.Context, numbers []*big.Int) ([]*types.BatchData, error)
59
+ ForcedBatchesByNumbers(ctx context.Context, numbers []*big.Int) ([]*types.BatchData, error)
60
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/pool/validium-001.sql RENAMED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- +migrate Down
2
+ DROP TABLE IF EXISTS pool.acl CASCADE;
3
+ DROP TABLE IF EXISTS pool.policy CASCADE;
4
+
5
+ -- +migrate Up
6
+ CREATE TABLE pool.policy
7
+ (
8
+ name VARCHAR PRIMARY KEY,
9
+ allow BOOLEAN NOT NULL DEFAULT false
10
+ );
11
+
12
+ INSERT INTO pool.policy (name, allow) VALUES ('send_tx', false);
13
+ INSERT INTO pool.policy (name, allow) VALUES ('deploy', false);
14
+
15
+ CREATE TABLE pool.acl
16
+ (
17
+ address VARCHAR,
18
+ policy VARCHAR,
19
+ PRIMARY KEY (address, policy)
20
+ );
{/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/validium-001.sql RENAMED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- +migrate Up
2
+
3
+ CREATE TABLE IF NOT EXISTS state.batch_data_backup
4
+ (
5
+ batch_num BIGINT,
6
+ data BYTEA,
7
+ created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
8
+ PRIMARY KEY (batch_num, created_at)
9
+ );
10
+
11
+ -- +migrate StatementBegin
12
+ CREATE OR REPLACE FUNCTION backup_batch() RETURNS trigger AS $$
13
+ BEGIN
14
+ INSERT INTO state.batch_data_backup (batch_num, data)
15
+ VALUES (OLD.batch_num, OLD.raw_txs_data)
16
+ ON CONFLICT (batch_num, created_at) DO UPDATE SET
17
+ data = EXCLUDED.data;
18
+ RETURN OLD;
19
+ END;
20
+ $$
21
+ LANGUAGE plpgsql;
22
+ -- +migrate StatementEnd
23
+
24
+ CREATE TRIGGER backup_batch
25
+ BEFORE DELETE ON state.batch FOR EACH ROW
26
+ EXECUTE PROCEDURE backup_batch();
27
+
28
+ -- +migrate Down
29
+
30
+ DROP TRIGGER IF EXISTS backup_batch ON state.batch;
31
+ DROP FUNCTION IF EXISTS backup_batch();
32
+ DROP TABLE IF EXISTS state.batch_data_backup;
{/home/stefan/go/src/Polygon/zkevm-node → .}/diffgen.sh RENAMED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PATH_TO_ZKEVM_NODE_REPO="/home/stefan/go/src/Polygon/zkevm-node/"
2
+ diff -ruN \
3
+ -I ".*github.com\/0x.*" \
4
+ -x "*mock*" -x ".git" \
5
+ -x ".github" \
6
+ -x ".gitignore" \
7
+ -x ".vscode" \
8
+ -x "ci" \
9
+ -x "environments" \
10
+ -x "*.md" \
11
+ -x "*.html" \
12
+ -x "*.html" \
13
+ -x "*.json" \
14
+ -x "*.toml" \
15
+ -x "*.abi" \
16
+ -x "*.bin" \
17
+ -x "*.pb.go" \
18
+ -x "smartcontracts" \
19
+ -x "go.sum" \
20
+ -x "mock*.go" \
21
+ -x "*venv*" \
22
+ -x "/dist/" \
23
+ -x "/test/e2e/keystore" \
24
+ -x "/test/vectors/src/**/*md" \
25
+ -x "/test/vectors/src/**/*js" \
26
+ -x "/test/vectors/src/**/*sol" \
27
+ -x "/test/vectors/src/**/*sh" \
28
+ -x "/test/vectors/src/package.json" \
29
+ -x "/test/contracts/bin/**/*.bin" \
30
+ -x "/test/contracts/bin/**/*.abi" \
31
+ -x "/tools/datastreamer/*.bin" \
32
+ -x "/test/datastreamer/*.db/*" \
33
+ -x "/test/*.bin" \
34
+ -x "/test/*.db/*" \
35
+ -x "**/.DS_Store" \
36
+ -x ".vscode" \
37
+ -x ".idea/" \
38
+ -x ".env" \
39
+ -x "out.dat" \
40
+ -x "cmd/__debug_bin" \
41
+ -x ".venv" \
42
+ -x "*metrics.txt" \
43
+ -x "coverage.out" \
44
+ -x "*datastream.db*" \
45
+ ${PATH_TO_ZKEVM_NODE_REPO} . | \
46
+ diff2html -i stdin -s side -t "zkEVM node vs CDK validium node</br><h2>zkevm-node version: v0.6.0<h2/>" \
47
+ -F ./docs/diff/diff.html
{/home/stefan/go/src/Polygon/zkevm-node → .}/Dockerfile RENAMED
@@ -14,7 +14,6 @@
14
  # CONTAINER FOR RUNNING BINARY
15
  FROM alpine:3.18
16
  COPY --from=build /src/dist/zkevm-node /app/zkevm-node
17
- COPY --from=build /src/config/environments/testnet/node.config.toml /app/example.config.toml
18
  RUN apk update && apk add postgresql15-client
19
  EXPOSE 8123
20
  CMD ["/bin/sh", "-c", "/app/zkevm-node run"]
 
14
  # CONTAINER FOR RUNNING BINARY
15
  FROM alpine:3.18
16
  COPY --from=build /src/dist/zkevm-node /app/zkevm-node
 
17
  RUN apk update && apk add postgresql15-client
18
  EXPOSE 8123
19
  CMD ["/bin/sh", "-c", "/app/zkevm-node run"]
{/home/stefan/go/src/Polygon/zkevm-node → .}/Dockerfile.release RENAMED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM alpine:3.18
2
+
3
+ COPY zkevm-node /app/zkevm-node
4
+
5
+ EXPOSE 8123
6
+
7
+ RUN addgroup -S zkevm-group \
8
+ && adduser -S zkevm-user -G zkevm-group
9
+
10
+ RUN chown -R zkevm-user:zkevm-group /app
11
+
12
+ USER zkevm-user
13
+
14
+ CMD ["/app/zkevm-node"]
15
+
{/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/etherman.go RENAMED
@@ -3,6 +3,7 @@
3
  import (
4
  "bytes"
5
  "context"
 
6
  "encoding/json"
7
  "errors"
8
  "fmt"
@@ -106,6 +109,11 @@
106
  // methodIDSequenceBatchesElderberry: MethodID for sequenceBatches in Elderberry
107
  methodIDSequenceBatchesElderberry = []byte{0xde, 0xf5, 0x7e, 0x54} // 0xdef57e54 sequenceBatches((bytes,bytes32,uint64,bytes32)[],uint64,uint64,address)
108
 
 
 
 
 
 
109
  // ErrNotFound is used when the object is not found
110
  ErrNotFound = errors.New("not found")
111
  // ErrIsReadOnlyMode is used when the EtherMan client is in read-only mode.
@@ -189,6 +197,7 @@
189
  GlobalExitRootManager *polygonzkevmglobalexitroot.Polygonzkevmglobalexitroot
190
  OldGlobalExitRootManager *oldpolygonzkevmglobalexitroot.Oldpolygonzkevmglobalexitroot
191
  Pol *pol.Pol
 
192
  SCAddresses []common.Address
193
 
194
  RollupID uint32
@@ -198,10 +207,13 @@
198
  l1Cfg L1Config
199
  cfg Config
200
  auth map[common.Address]bind.TransactOpts // empty in case of read-only client
 
 
 
201
  }
202
 
203
  // NewClient creates a new etherman.
204
- func NewClient(cfg Config, l1Config L1Config) (*Client, error) {
205
  // Connect to ethereum node
206
  ethClient, err := ethclient.Dial(cfg.URL)
207
  if err != nil {
@@ -244,6 +256,14 @@
244
  log.Errorf("error creating NewPol client (%s). Error: %w", l1Config.PolAddr.String(), err)
245
  return nil, err
246
  }
 
 
 
 
 
 
 
 
247
  var scAddresses []common.Address
248
  scAddresses = append(scAddresses, l1Config.ZkEVMAddr, l1Config.RollupManagerAddr, l1Config.GlobalExitRootManagerAddr)
249
 
@@ -274,6 +294,7 @@
274
  RollupManager: rollupManager,
275
  Pol: pol,
276
  GlobalExitRootManager: globalExitRoot,
 
277
  OldGlobalExitRootManager: oldGlobalExitRoot,
278
  SCAddresses: scAddresses,
279
  RollupID: rollupID,
@@ -284,11 +305,14 @@
284
  l1Cfg: l1Config,
285
  cfg: cfg,
286
  auth: map[common.Address]bind.TransactOpts{},
 
 
287
  }, nil
288
  }
289
 
290
  // VerifyGenBlockNumber verifies if the genesis Block Number is valid
291
  func (etherMan *Client) VerifyGenBlockNumber(ctx context.Context, genBlockNumber uint64) (bool, error) {
 
292
  start := time.Now()
293
  log.Info("Verifying genesis blockNumber: ", genBlockNumber)
294
  // Filter query
@@ -344,6 +368,11 @@
344
  log.Debug("Getting forkIDs from blockNumber: ", genBlockNumber)
345
  start := time.Now()
346
  var logs []types.Log
 
 
 
 
 
347
  log.Debug("Using ForkIDChunkSize: ", etherMan.cfg.ForkIDChunkSize)
348
  for i := genBlockNumber; i <= lastL1BlockSynced; i = i + etherMan.cfg.ForkIDChunkSize + 1 {
349
  final := i + etherMan.cfg.ForkIDChunkSize
@@ -684,61 +713,8 @@
684
  return etherMan.updateForkId(ctx, vLog, blocks, blocksOrder, addExistingRollup.LastVerifiedBatchBeforeUpgrade, addExistingRollup.ForkID, "", addExistingRollup.RollupID)
685
  }
686
 
687
- func (etherMan *Client) updateEtrogSequence(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error {
688
- log.Debug("updateEtrogSequence event detected")
689
- updateEtrogSequence, err := etherMan.EtrogZKEVM.ParseUpdateEtrogSequence(vLog)
690
- if err != nil {
691
- log.Error("error parsing updateEtrogSequence event. Error: ", err)
692
- return err
693
- }
694
-
695
- // Read the tx for this event.
696
- tx, err := etherMan.EthClient.TransactionInBlock(ctx, vLog.BlockHash, vLog.TxIndex)
697
- if err != nil {
698
- return err
699
- }
700
- if tx.Hash() != vLog.TxHash {
701
- return fmt.Errorf("error: tx hash mismatch. want: %s have: %s", vLog.TxHash, tx.Hash().String())
702
- }
703
- msg, err := core.TransactionToMessage(tx, types.NewLondonSigner(tx.ChainId()), big.NewInt(0))
704
- if err != nil {
705
- return err
706
- }
707
- fullBlock, err := etherMan.EthClient.BlockByHash(ctx, vLog.BlockHash)
708
- if err != nil {
709
- return fmt.Errorf("error getting fullBlockInfo. BlockNumber: %d. Error: %w", vLog.BlockNumber, err)
710
- }
711
-
712
- log.Info("update Etrog transaction sequence...")
713
- sequence := UpdateEtrogSequence{
714
- BatchNumber: updateEtrogSequence.NumBatch,
715
- SequencerAddr: updateEtrogSequence.Sequencer,
716
- TxHash: vLog.TxHash,
717
- Nonce: msg.Nonce,
718
- PolygonRollupBaseEtrogBatchData: &polygonzkevm.PolygonRollupBaseEtrogBatchData{
719
- Transactions: updateEtrogSequence.Transactions,
720
- ForcedGlobalExitRoot: updateEtrogSequence.LastGlobalExitRoot,
721
- ForcedTimestamp: fullBlock.Time(),
722
- ForcedBlockHashL1: fullBlock.ParentHash(),
723
- },
724
- }
725
-
726
- if len(*blocks) == 0 || ((*blocks)[len(*blocks)-1].BlockHash != vLog.BlockHash || (*blocks)[len(*blocks)-1].BlockNumber != vLog.BlockNumber) {
727
- block := prepareBlock(vLog, time.Unix(int64(fullBlock.Time()), 0), fullBlock)
728
- block.UpdateEtrogSequence = sequence
729
- *blocks = append(*blocks, block)
730
- } else if (*blocks)[len(*blocks)-1].BlockHash == vLog.BlockHash && (*blocks)[len(*blocks)-1].BlockNumber == vLog.BlockNumber {
731
- (*blocks)[len(*blocks)-1].UpdateEtrogSequence = sequence
732
- } else {
733
- log.Error("Error processing UpdateEtrogSequence event. BlockHash:", vLog.BlockHash, ". BlockNumber: ", vLog.BlockNumber)
734
- return fmt.Errorf("error processing UpdateEtrogSequence event")
735
- }
736
- or := Order{
737
- Name: UpdateEtrogSequenceOrder,
738
- Pos: 0,
739
- }
740
- (*blocksOrder)[(*blocks)[len(*blocks)-1].BlockHash] = append((*blocksOrder)[(*blocks)[len(*blocks)-1].BlockHash], or)
741
- return nil
742
  }
743
 
744
  func (etherMan *Client) initialSequenceBatches(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error {
@@ -937,14 +913,14 @@
937
  }
938
 
939
  // EstimateGasSequenceBatches estimates gas for sending batches
940
- func (etherMan *Client) EstimateGasSequenceBatches(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address) (*types.Transaction, error) {
941
  opts, err := etherMan.getAuthByAddress(sender)
942
  if err == ErrNotFound {
943
  return nil, ErrPrivateKeyNotFound
944
  }
945
  opts.NoSend = true
946
 
947
- tx, err := etherMan.sequenceBatches(opts, sequences, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase)
948
  if err != nil {
949
  return nil, err
950
  }
@@ -953,7 +929,7 @@
953
  }
954
 
955
  // BuildSequenceBatchesTxData builds a []bytes to be sent to the PoE SC method SequenceBatches.
956
- func (etherMan *Client) BuildSequenceBatchesTxData(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address) (to *common.Address, data []byte, err error) {
957
  opts, err := etherMan.getAuthByAddress(sender)
958
  if err == ErrNotFound {
959
  return nil, nil, fmt.Errorf("failed to build sequence batches, err: %w", ErrPrivateKeyNotFound)
@@ -964,7 +940,7 @@
964
  opts.GasLimit = uint64(1)
965
  opts.GasPrice = big.NewInt(1)
966
 
967
- tx, err := etherMan.sequenceBatches(opts, sequences, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase)
968
  if err != nil {
969
  return nil, nil, err
970
  }
@@ -972,15 +948,15 @@
972
  return tx.To(), tx.Data(), nil
973
  }
974
 
975
- func (etherMan *Client) sequenceBatches(opts bind.TransactOpts, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address) (*types.Transaction, error) {
976
- var batches []polygonzkevm.PolygonRollupBaseEtrogBatchData
977
  for _, seq := range sequences {
978
  var ger common.Hash
979
  if seq.ForcedBatchTimestamp > 0 {
980
  ger = seq.GlobalExitRoot
981
  }
982
- batch := polygonzkevm.PolygonRollupBaseEtrogBatchData{
983
- Transactions: seq.BatchL2Data,
984
  ForcedGlobalExitRoot: ger,
985
  ForcedTimestamp: uint64(seq.ForcedBatchTimestamp),
986
  ForcedBlockHashL1: seq.PrevBlockHash,
@@ -989,7 +965,7 @@
989
  batches = append(batches, batch)
990
  }
991
 
992
- tx, err := etherMan.ZkEVM.SequenceBatches(&opts, batches, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase)
993
  if err != nil {
994
  log.Debugf("Batches to send: %+v", batches)
995
  log.Debug("l2CoinBase: ", l2Coinbase)
@@ -1208,13 +1184,15 @@
1208
  if sb.NumBatch != 1 {
1209
  methodId := tx.Data()[:4]
1210
  log.Debugf("MethodId: %s", common.Bytes2Hex(methodId))
1211
- if bytes.Equal(methodId, methodIDSequenceBatchesEtrog) {
1212
- sequences, err = decodeSequencesEtrog(tx.Data(), sb.NumBatch, msg.From, vLog.TxHash, msg.Nonce, sb.L1InfoRoot)
 
1213
  if err != nil {
1214
  return fmt.Errorf("error decoding the sequences (etrog): %v", err)
1215
  }
1216
- } else if bytes.Equal(methodId, methodIDSequenceBatchesElderberry) {
1217
- sequences, err = decodeSequencesElderberry(tx.Data(), sb.NumBatch, msg.From, vLog.TxHash, msg.Nonce, sb.L1InfoRoot)
 
1218
  if err != nil {
1219
  return fmt.Errorf("error decoding the sequences (elderberry): %v", err)
1220
  }
@@ -1300,7 +1278,8 @@
1300
  return nil
1301
  }
1302
 
1303
- func decodeSequencesElderberry(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64, l1InfoRoot common.Hash) ([]SequencedBatch, error) {
 
1304
  // Extract coded txs.
1305
  // Load contract ABI
1306
  smcAbi, err := abi.JSON(strings.NewReader(polygonzkevm.PolygonzkevmABI))
@@ -1308,6 +1287,25 @@
1308
  return nil, err
1309
  }
1310
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1311
  // Recover Method from signature and ABI
1312
  method, err := smcAbi.MethodById(txData[:4])
1313
  if err != nil {
@@ -1319,87 +1317,216 @@
1319
  if err != nil {
1320
  return nil, err
1321
  }
1322
- var sequences []polygonzkevm.PolygonRollupBaseEtrogBatchData
1323
  bytedata, err := json.Marshal(data[0])
1324
  if err != nil {
1325
  return nil, err
1326
  }
1327
- err = json.Unmarshal(bytedata, &sequences)
1328
- if err != nil {
1329
- return nil, err
1330
- }
1331
- maxSequenceTimestamp := data[1].(uint64)
1332
- initSequencedBatchNumber := data[2].(uint64)
1333
- coinbase := (data[3]).(common.Address)
1334
- sequencedBatches := make([]SequencedBatch, len(sequences))
1335
 
1336
- for i, seq := range sequences {
1337
- elderberry := SequencedBatchElderberryData{
1338
- MaxSequenceTimestamp: maxSequenceTimestamp,
1339
- InitSequencedBatchNumber: initSequencedBatchNumber,
 
 
 
 
 
 
 
 
1340
  }
1341
- bn := lastBatchNumber - uint64(len(sequences)-(i+1))
1342
- s := seq
1343
- sequencedBatches[i] = SequencedBatch{
1344
- BatchNumber: bn,
1345
- L1InfoRoot: &l1InfoRoot,
1346
- SequencerAddr: sequencer,
1347
- TxHash: txHash,
1348
- Nonce: nonce,
1349
- Coinbase: coinbase,
1350
- PolygonRollupBaseEtrogBatchData: &s,
1351
- SequencedBatchElderberryData: &elderberry,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1352
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1353
  }
1354
 
1355
- return sequencedBatches, nil
1356
  }
1357
 
1358
- func decodeSequencesEtrog(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64, l1InfoRoot common.Hash) ([]SequencedBatch, error) {
1359
- // Extract coded txs.
1360
- // Load contract ABI
1361
- smcAbi, err := abi.JSON(strings.NewReader(etrogpolygonzkevm.EtrogpolygonzkevmABI))
 
 
 
 
1362
  if err != nil {
1363
  return nil, err
1364
  }
1365
-
1366
- // Recover Method from signature and ABI
1367
- method, err := smcAbi.MethodById(txData[:4])
1368
  if err != nil {
1369
  return nil, err
1370
  }
 
 
 
 
 
 
 
 
 
 
 
1371
 
1372
- // Unpack method inputs
1373
- data, err := method.Inputs.Unpack(txData[4:])
1374
- if err != nil {
1375
- return nil, err
 
 
 
 
1376
  }
1377
- var sequences []polygonzkevm.PolygonRollupBaseEtrogBatchData
1378
- bytedata, err := json.Marshal(data[0])
 
 
 
1379
  if err != nil {
1380
  return nil, err
1381
  }
1382
- err = json.Unmarshal(bytedata, &sequences)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1383
  if err != nil {
1384
  return nil, err
1385
  }
1386
- coinbase := (data[1]).(common.Address)
1387
- sequencedBatches := make([]SequencedBatch, len(sequences))
1388
- for i, seq := range sequences {
1389
- bn := lastBatchNumber - uint64(len(sequences)-(i+1))
1390
- s := seq
1391
- sequencedBatches[i] = SequencedBatch{
1392
- BatchNumber: bn,
1393
- L1InfoRoot: &l1InfoRoot,
1394
- SequencerAddr: sequencer,
1395
- TxHash: txHash,
1396
- Nonce: nonce,
1397
- Coinbase: coinbase,
1398
- PolygonRollupBaseEtrogBatchData: &s,
1399
  }
1400
  }
1401
-
1402
- return sequencedBatches, nil
1403
  }
1404
 
1405
  func decodeSequencesPreEtrog(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64) ([]SequencedBatch, error) {
@@ -1882,15 +2009,15 @@
1882
  }
1883
 
1884
  // LoadAuthFromKeyStore loads an authorization from a key store file
1885
- func (etherMan *Client) LoadAuthFromKeyStore(path, password string) (*bind.TransactOpts, error) {
1886
- auth, err := newAuthFromKeystore(path, password, etherMan.l1Cfg.L1ChainID)
1887
  if err != nil {
1888
- return nil, err
1889
  }
1890
 
1891
  log.Infof("loaded authorization for address: %v", auth.From.String())
1892
  etherMan.auth[auth.From] = auth
1893
- return &auth, nil
1894
  }
1895
 
1896
  // newKeyFromKeystore creates an instance of a keystore key from a keystore file
@@ -1911,20 +2038,20 @@
1911
  }
1912
 
1913
  // newAuthFromKeystore an authorization instance from a keystore file
1914
- func newAuthFromKeystore(path, password string, chainID uint64) (bind.TransactOpts, error) {
1915
  log.Infof("reading key from: %v", path)
1916
  key, err := newKeyFromKeystore(path, password)
1917
  if err != nil {
1918
- return bind.TransactOpts{}, err
1919
  }
1920
  if key == nil {
1921
- return bind.TransactOpts{}, nil
1922
  }
1923
  auth, err := bind.NewKeyedTransactorWithChainID(key.PrivateKey, new(big.Int).SetUint64(chainID))
1924
  if err != nil {
1925
- return bind.TransactOpts{}, err
1926
  }
1927
- return *auth, nil
1928
  }
1929
 
1930
  // getAuthByAddress tries to get an authorization from the authorizations map
@@ -1952,3 +2079,28 @@
1952
 
1953
  return *auth, nil
1954
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  import (
4
  "bytes"
5
  "context"
6
+ "crypto/ecdsa"
7
  "encoding/json"
8
  "errors"
9
  "fmt"
 
109
  // methodIDSequenceBatchesElderberry: MethodID for sequenceBatches in Elderberry
110
  methodIDSequenceBatchesElderberry = []byte{0xde, 0xf5, 0x7e, 0x54} // 0xdef57e54 sequenceBatches((bytes,bytes32,uint64,bytes32)[],uint64,uint64,address)
111
 
112
+ // methodIDSequenceBatchesValidiumEtrog: MethodID for sequenceBatchesValidium in Etrog
113
+ methodIDSequenceBatchesValidiumEtrog = []byte{0x2d, 0x72, 0xc2, 0x48} // 0x2d72c248 sequenceBatchesValidium((bytes32,bytes32,uint64,bytes32)[],address,bytes)
114
+ // methodIDSequenceBatchesValidiumElderberry: MethodID for sequenceBatchesValidium in Elderberry
115
+ methodIDSequenceBatchesValidiumElderberry = []byte{0xdb, 0x5b, 0x0e, 0xd7} // 0xdb5b0ed7 sequenceBatchesValidium((bytes32,bytes32,uint64,bytes32)[],uint64,uint64,address,bytes)
116
+
117
  // ErrNotFound is used when the object is not found
118
  ErrNotFound = errors.New("not found")
119
  // ErrIsReadOnlyMode is used when the EtherMan client is in read-only mode.
 
197
  GlobalExitRootManager *polygonzkevmglobalexitroot.Polygonzkevmglobalexitroot
198
  OldGlobalExitRootManager *oldpolygonzkevmglobalexitroot.Oldpolygonzkevmglobalexitroot
199
  Pol *pol.Pol
200
+ DAProtocol *dataavailabilityprotocol.Dataavailabilityprotocol
201
  SCAddresses []common.Address
202
 
203
  RollupID uint32
 
207
  l1Cfg L1Config
208
  cfg Config
209
  auth map[common.Address]bind.TransactOpts // empty in case of read-only client
210
+
211
+ da dataavailability.BatchDataProvider
212
+ state stateProvider
213
  }
214
 
215
  // NewClient creates a new etherman.
216
+ func NewClient(cfg Config, l1Config L1Config, da dataavailability.BatchDataProvider, st stateProvider) (*Client, error) {
217
  // Connect to ethereum node
218
  ethClient, err := ethclient.Dial(cfg.URL)
219
  if err != nil {
 
256
  log.Errorf("error creating NewPol client (%s). Error: %w", l1Config.PolAddr.String(), err)
257
  return nil, err
258
  }
259
+ dapAddr, err := zkevm.DataAvailabilityProtocol(&bind.CallOpts{Pending: false})
260
+ if err != nil {
261
+ return nil, err
262
+ }
263
+ dap, err := dataavailabilityprotocol.NewDataavailabilityprotocol(dapAddr, ethClient)
264
+ if err != nil {
265
+ return nil, err
266
+ }
267
  var scAddresses []common.Address
268
  scAddresses = append(scAddresses, l1Config.ZkEVMAddr, l1Config.RollupManagerAddr, l1Config.GlobalExitRootManagerAddr)
269
 
 
294
  RollupManager: rollupManager,
295
  Pol: pol,
296
  GlobalExitRootManager: globalExitRoot,
297
+ DAProtocol: dap,
298
  OldGlobalExitRootManager: oldGlobalExitRoot,
299
  SCAddresses: scAddresses,
300
  RollupID: rollupID,
 
305
  l1Cfg: l1Config,
306
  cfg: cfg,
307
  auth: map[common.Address]bind.TransactOpts{},
308
+ da: da,
309
+ state: st,
310
  }, nil
311
  }
312
 
313
  // VerifyGenBlockNumber verifies if the genesis Block Number is valid
314
  func (etherMan *Client) VerifyGenBlockNumber(ctx context.Context, genBlockNumber uint64) (bool, error) {
315
+ // TODO: do not assume that only one rollup will be attached to the rollup manager in the same L1 block
316
  start := time.Now()
317
  log.Info("Verifying genesis blockNumber: ", genBlockNumber)
318
  // Filter query
 
368
  log.Debug("Getting forkIDs from blockNumber: ", genBlockNumber)
369
  start := time.Now()
370
  var logs []types.Log
371
+
372
+ if lastL1BlockSynced < genBlockNumber {
373
+ lastL1BlockSynced = genBlockNumber
374
+ }
375
+
376
  log.Debug("Using ForkIDChunkSize: ", etherMan.cfg.ForkIDChunkSize)
377
  for i := genBlockNumber; i <= lastL1BlockSynced; i = i + etherMan.cfg.ForkIDChunkSize + 1 {
378
  final := i + etherMan.cfg.ForkIDChunkSize
 
713
  return etherMan.updateForkId(ctx, vLog, blocks, blocksOrder, addExistingRollup.LastVerifiedBatchBeforeUpgrade, addExistingRollup.ForkID, "", addExistingRollup.RollupID)
714
  }
715
 
716
+ func (etherMan *Client) updateEtrogSequence(_ context.Context, _ types.Log, _ *[]Block, _ *map[common.Hash][]Order) error {
717
+ return errors.New("upgrading validiums to etrog not supported")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
718
  }
719
 
720
  func (etherMan *Client) initialSequenceBatches(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error {
 
913
  }
914
 
915
  // EstimateGasSequenceBatches estimates gas for sending batches
916
+ func (etherMan *Client) EstimateGasSequenceBatches(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address, dataAvailabilityMessage []byte) (*types.Transaction, error) {
917
  opts, err := etherMan.getAuthByAddress(sender)
918
  if err == ErrNotFound {
919
  return nil, ErrPrivateKeyNotFound
920
  }
921
  opts.NoSend = true
922
 
923
+ tx, err := etherMan.sequenceBatches(opts, sequences, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase, dataAvailabilityMessage)
924
  if err != nil {
925
  return nil, err
926
  }
 
929
  }
930
 
931
  // BuildSequenceBatchesTxData builds a []bytes to be sent to the PoE SC method SequenceBatches.
932
+ func (etherMan *Client) BuildSequenceBatchesTxData(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address, dataAvailabilityMessage []byte) (to *common.Address, data []byte, err error) {
933
  opts, err := etherMan.getAuthByAddress(sender)
934
  if err == ErrNotFound {
935
  return nil, nil, fmt.Errorf("failed to build sequence batches, err: %w", ErrPrivateKeyNotFound)
 
940
  opts.GasLimit = uint64(1)
941
  opts.GasPrice = big.NewInt(1)
942
 
943
+ tx, err := etherMan.sequenceBatches(opts, sequences, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase, dataAvailabilityMessage)
944
  if err != nil {
945
  return nil, nil, err
946
  }
 
948
  return tx.To(), tx.Data(), nil
949
  }
950
 
951
+ func (etherMan *Client) sequenceBatches(opts bind.TransactOpts, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address, dataAvailabilityMessage []byte) (*types.Transaction, error) {
952
+ var batches []polygonzkevm.PolygonValidiumEtrogValidiumBatchData
953
  for _, seq := range sequences {
954
  var ger common.Hash
955
  if seq.ForcedBatchTimestamp > 0 {
956
  ger = seq.GlobalExitRoot
957
  }
958
+ batch := polygonzkevm.PolygonValidiumEtrogValidiumBatchData{
959
+ TransactionsHash: crypto.Keccak256Hash(seq.BatchL2Data),
960
  ForcedGlobalExitRoot: ger,
961
  ForcedTimestamp: uint64(seq.ForcedBatchTimestamp),
962
  ForcedBlockHashL1: seq.PrevBlockHash,
 
965
  batches = append(batches, batch)
966
  }
967
 
968
+ tx, err := etherMan.ZkEVM.SequenceBatchesValidium(&opts, batches, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase, dataAvailabilityMessage)
969
  if err != nil {
970
  log.Debugf("Batches to send: %+v", batches)
971
  log.Debug("l2CoinBase: ", l2Coinbase)
 
1184
  if sb.NumBatch != 1 {
1185
  methodId := tx.Data()[:4]
1186
  log.Debugf("MethodId: %s", common.Bytes2Hex(methodId))
1187
+ if bytes.Equal(methodId, methodIDSequenceBatchesEtrog) ||
1188
+ bytes.Equal(methodId, methodIDSequenceBatchesValidiumEtrog) {
1189
+ sequences, err = decodeSequencesEtrog(tx.Data(), sb.NumBatch, msg.From, vLog.TxHash, msg.Nonce, sb.L1InfoRoot, etherMan.da, etherMan.state)
1190
  if err != nil {
1191
  return fmt.Errorf("error decoding the sequences (etrog): %v", err)
1192
  }
1193
+ } else if bytes.Equal(methodId, methodIDSequenceBatchesElderberry) ||
1194
+ bytes.Equal(methodId, methodIDSequenceBatchesValidiumElderberry) {
1195
+ sequences, err = decodeSequencesElderberry(tx.Data(), sb.NumBatch, msg.From, vLog.TxHash, msg.Nonce, sb.L1InfoRoot, etherMan.da, etherMan.state)
1196
  if err != nil {
1197
  return fmt.Errorf("error decoding the sequences (elderberry): %v", err)
1198
  }
 
1278
  return nil
1279
  }
1280
 
1281
+ func decodeSequencesElderberry(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64,
1282
+ l1InfoRoot common.Hash, da dataavailability.BatchDataProvider, st stateProvider) ([]SequencedBatch, error) {
1283
  // Extract coded txs.
1284
  // Load contract ABI
1285
  smcAbi, err := abi.JSON(strings.NewReader(polygonzkevm.PolygonzkevmABI))
 
1287
  return nil, err
1288
  }
1289
 
1290
+ return decodeSequencedBatches(smcAbi, txData, state.FORKID_ELDERBERRY, lastBatchNumber, sequencer, txHash, nonce, l1InfoRoot, da, st)
1291
+ }
1292
+
1293
+ func decodeSequencesEtrog(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64, l1InfoRoot common.Hash,
1294
+ da dataavailability.BatchDataProvider, st stateProvider) ([]SequencedBatch, error) {
1295
+ // Extract coded txs.
1296
+ // Load contract ABI
1297
+ smcAbi, err := abi.JSON(strings.NewReader(etrogpolygonzkevm.EtrogpolygonzkevmABI))
1298
+ if err != nil {
1299
+ return nil, err
1300
+ }
1301
+
1302
+ return decodeSequencedBatches(smcAbi, txData, state.FORKID_ETROG, lastBatchNumber, sequencer, txHash, nonce, l1InfoRoot, da, st)
1303
+ }
1304
+
1305
+ // decodeSequencedBatches decodes provided data, based on the funcName, whether it is rollup or validium data and returns sequenced batches
1306
+ func decodeSequencedBatches(smcAbi abi.ABI, txData []byte, forkID uint64, lastBatchNumber uint64,
1307
+ sequencer common.Address, txHash common.Hash, nonce uint64, l1InfoRoot common.Hash,
1308
+ da dataavailability.BatchDataProvider, st stateProvider) ([]SequencedBatch, error) {
1309
  // Recover Method from signature and ABI
1310
  method, err := smcAbi.MethodById(txData[:4])
1311
  if err != nil {
 
1317
  if err != nil {
1318
  return nil, err
1319
  }
 
1320
  bytedata, err := json.Marshal(data[0])
1321
  if err != nil {
1322
  return nil, err
1323
  }
 
 
 
 
 
 
 
 
1324
 
1325
+ var (
1326
+ maxSequenceTimestamp uint64
1327
+ initSequencedBatchNumber uint64
1328
+ coinbase common.Address
1329
+ )
1330
+
1331
+ switch method.Name {
1332
+ case "sequenceBatches":
1333
+ var sequences []polygonzkevm.PolygonRollupBaseEtrogBatchData
1334
+ err := json.Unmarshal(bytedata, &sequences)
1335
+ if err != nil {
1336
+ return nil, err
1337
  }
1338
+
1339
+ switch forkID {
1340
+ case state.FORKID_ETROG:
1341
+ coinbase = data[1].(common.Address)
1342
+
1343
+ case state.FORKID_ELDERBERRY:
1344
+ maxSequenceTimestamp = data[1].(uint64)
1345
+ initSequencedBatchNumber = data[2].(uint64)
1346
+ coinbase = data[3].(common.Address)
1347
+ }
1348
+
1349
+ sequencedBatches := make([]SequencedBatch, len(sequences))
1350
+ for i, seq := range sequences {
1351
+ bn := lastBatchNumber - uint64(len(sequences)-(i+1))
1352
+ s := seq
1353
+ batch := SequencedBatch{
1354
+ BatchNumber: bn,
1355
+ L1InfoRoot: &l1InfoRoot,
1356
+ SequencerAddr: sequencer,
1357
+ TxHash: txHash,
1358
+ Nonce: nonce,
1359
+ Coinbase: coinbase,
1360
+ PolygonRollupBaseEtrogBatchData: &s,
1361
+ }
1362
+ if forkID >= state.FORKID_ELDERBERRY {
1363
+ batch.SequencedBatchElderberryData = &SequencedBatchElderberryData{
1364
+ MaxSequenceTimestamp: maxSequenceTimestamp,
1365
+ InitSequencedBatchNumber: initSequencedBatchNumber,
1366
+ }
1367
+ }
1368
+ sequencedBatches[i] = batch
1369
  }
1370
+
1371
+ return sequencedBatches, nil
1372
+ case "sequenceBatchesValidium":
1373
+ var (
1374
+ sequencesValidium []polygonzkevm.PolygonValidiumEtrogValidiumBatchData
1375
+ dataAvailabilityMsg []byte
1376
+ )
1377
+ err := json.Unmarshal(bytedata, &sequencesValidium)
1378
+ if err != nil {
1379
+ return nil, err
1380
+ }
1381
+
1382
+ switch forkID {
1383
+ case state.FORKID_ETROG:
1384
+ coinbase = data[1].(common.Address)
1385
+ dataAvailabilityMsg = data[2].([]byte)
1386
+
1387
+ case state.FORKID_ELDERBERRY:
1388
+ maxSequenceTimestamp = data[1].(uint64)
1389
+ initSequencedBatchNumber = data[2].(uint64)
1390
+ coinbase = data[3].(common.Address)
1391
+ dataAvailabilityMsg = data[4].([]byte)
1392
+ }
1393
+
1394
+ // Pair the batch number, hash, and if it is forced. This will allow
1395
+ // retrieval from different sources, and keep them in original order.
1396
+ var batchInfos []batchInfo
1397
+ for i, d := range sequencesValidium {
1398
+ bn := lastBatchNumber - uint64(len(sequencesValidium)-(i+1))
1399
+ forced := d.ForcedTimestamp > 0
1400
+ h := d.TransactionsHash
1401
+ batchInfos = append(batchInfos, batchInfo{num: bn, hash: h, isForced: forced})
1402
+ }
1403
+
1404
+ batchData, err := retrieveBatchData(da, st, batchInfos, dataAvailabilityMsg)
1405
+ if err != nil {
1406
+ return nil, err
1407
+ }
1408
+
1409
+ sequencedBatches := make([]SequencedBatch, len(sequencesValidium))
1410
+ for i, info := range batchInfos {
1411
+ bn := info.num
1412
+ s := polygonzkevm.PolygonRollupBaseEtrogBatchData{
1413
+ Transactions: batchData[i],
1414
+ ForcedGlobalExitRoot: sequencesValidium[i].ForcedGlobalExitRoot,
1415
+ ForcedTimestamp: sequencesValidium[i].ForcedTimestamp,
1416
+ ForcedBlockHashL1: sequencesValidium[i].ForcedBlockHashL1,
1417
+ }
1418
+ batch := SequencedBatch{
1419
+ BatchNumber: bn,
1420
+ L1InfoRoot: &l1InfoRoot,
1421
+ SequencerAddr: sequencer,
1422
+ TxHash: txHash,
1423
+ Nonce: nonce,
1424
+ Coinbase: coinbase,
1425
+ PolygonRollupBaseEtrogBatchData: &s,
1426
+ }
1427
+ if forkID >= state.FORKID_ELDERBERRY {
1428
+ elderberry := &SequencedBatchElderberryData{
1429
+ MaxSequenceTimestamp: maxSequenceTimestamp,
1430
+ InitSequencedBatchNumber: initSequencedBatchNumber,
1431
+ }
1432
+ batch.SequencedBatchElderberryData = elderberry
1433
+ }
1434
+ sequencedBatches[i] = batch
1435
+ }
1436
+
1437
+ return sequencedBatches, nil
1438
  }
1439
 
1440
+ return nil, fmt.Errorf("unexpected method called in sequence batches transaction: %s", method.RawName)
1441
  }
1442
 
1443
+ type batchInfo struct {
1444
+ num uint64
1445
+ hash common.Hash
1446
+ isForced bool
1447
+ }
1448
+
1449
+ func retrieveBatchData(da dataavailability.BatchDataProvider, st stateProvider, batchInfos []batchInfo, daMessage []byte) ([][]byte, error) {
1450
+ validiumData, err := getBatchL2Data(da, batchInfos, daMessage)
1451
  if err != nil {
1452
  return nil, err
1453
  }
1454
+ forcedData, err := getForcedBatchData(st, batchInfos)
 
 
1455
  if err != nil {
1456
  return nil, err
1457
  }
1458
+ data := make([][]byte, len(batchInfos))
1459
+ for i, info := range batchInfos {
1460
+ bn := info.num
1461
+ if info.isForced {
1462
+ data[i] = forcedData[bn]
1463
+ } else {
1464
+ data[i] = validiumData[bn]
1465
+ }
1466
+ }
1467
+ return data, nil
1468
+ }
1469
 
1470
+ func getBatchL2Data(da dataavailability.BatchDataProvider, batchInfos []batchInfo, daMessage []byte) (map[uint64][]byte, error) {
1471
+ var batchNums []uint64
1472
+ var batchHashes []common.Hash
1473
+ for _, info := range batchInfos {
1474
+ if !info.isForced {
1475
+ batchNums = append(batchNums, info.num)
1476
+ batchHashes = append(batchHashes, info.hash)
1477
+ }
1478
  }
1479
+ if len(batchNums) == 0 {
1480
+ return nil, nil
1481
+ }
1482
+
1483
+ batchL2Data, err := da.GetBatchL2Data(batchNums, batchHashes, daMessage)
1484
  if err != nil {
1485
  return nil, err
1486
  }
1487
+
1488
+ if len(batchL2Data) != len(batchNums) {
1489
+ return nil,
1490
+ fmt.Errorf("failed to retrieve all batch data. Expected %d, got %d", len(batchNums), len(batchL2Data))
1491
+ }
1492
+
1493
+ data := make(map[uint64][]byte)
1494
+ for i, bn := range batchNums {
1495
+ data[bn] = batchL2Data[i]
1496
+ }
1497
+
1498
+ return data, nil
1499
+ }
1500
+
1501
+ func getForcedBatchData(st stateProvider, batchInfos []batchInfo) (map[uint64][]byte, error) {
1502
+ var batchNums []uint64
1503
+ var batchHashes []common.Hash
1504
+ for _, info := range batchInfos {
1505
+ if info.isForced {
1506
+ batchNums = append(batchNums, info.num)
1507
+ batchHashes = append(batchHashes, info.hash)
1508
+ }
1509
+ }
1510
+ if len(batchNums) == 0 {
1511
+ return nil, nil
1512
+ }
1513
+ data, err := st.GetForcedBatchDataByNumbers(context.Background(), batchNums, nil)
1514
  if err != nil {
1515
  return nil, err
1516
  }
1517
+
1518
+ for i, bn := range batchNums {
1519
+ expectedHash := batchHashes[i]
1520
+ d, ok := data[bn]
1521
+ if !ok {
1522
+ return nil, fmt.Errorf("missing forced batch data for number %d", bn)
1523
+ }
1524
+ actualHash := crypto.Keccak256Hash(d)
1525
+ if actualHash != expectedHash {
1526
+ return nil, fmt.Errorf("got wrong hash for forced batch data number %d", bn)
 
 
 
1527
  }
1528
  }
1529
+ return data, nil
 
1530
  }
1531
 
1532
  func decodeSequencesPreEtrog(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64) ([]SequencedBatch, error) {
 
2009
  }
2010
 
2011
  // LoadAuthFromKeyStore loads an authorization from a key store file
2012
+ func (etherMan *Client) LoadAuthFromKeyStore(path, password string) (*bind.TransactOpts, *ecdsa.PrivateKey, error) {
2013
+ auth, pk, err := newAuthFromKeystore(path, password, etherMan.l1Cfg.L1ChainID)
2014
  if err != nil {
2015
+ return nil, nil, err
2016
  }
2017
 
2018
  log.Infof("loaded authorization for address: %v", auth.From.String())
2019
  etherMan.auth[auth.From] = auth
2020
+ return &auth, pk, nil
2021
  }
2022
 
2023
  // newKeyFromKeystore creates an instance of a keystore key from a keystore file
 
2038
  }
2039
 
2040
  // newAuthFromKeystore an authorization instance from a keystore file
2041
+ func newAuthFromKeystore(path, password string, chainID uint64) (bind.TransactOpts, *ecdsa.PrivateKey, error) {
2042
  log.Infof("reading key from: %v", path)
2043
  key, err := newKeyFromKeystore(path, password)
2044
  if err != nil {
2045
+ return bind.TransactOpts{}, nil, err
2046
  }
2047
  if key == nil {
2048
+ return bind.TransactOpts{}, nil, nil
2049
  }
2050
  auth, err := bind.NewKeyedTransactorWithChainID(key.PrivateKey, new(big.Int).SetUint64(chainID))
2051
  if err != nil {
2052
+ return bind.TransactOpts{}, nil, err
2053
  }
2054
+ return *auth, key.PrivateKey, nil
2055
  }
2056
 
2057
  // getAuthByAddress tries to get an authorization from the authorizations map
 
2079
 
2080
  return *auth, nil
2081
  }
2082
+
2083
+ // GetDAProtocolAddr returns the address of the data availability protocol
2084
+ func (etherMan *Client) GetDAProtocolAddr() (common.Address, error) {
2085
+ return etherMan.ZkEVM.DataAvailabilityProtocol(&bind.CallOpts{Pending: false})
2086
+ }
2087
+
2088
+ // GetDAProtocolName returns the name of the data availability protocol
2089
+ func (etherMan *Client) GetDAProtocolName() (string, error) {
2090
+ return etherMan.DAProtocol.GetProcotolName(&bind.CallOpts{Pending: false})
2091
+ }
2092
+
2093
+ // SetDataAvailabilityProtocol sets the address for the new data availability protocol
2094
+ func (etherMan *Client) SetDataAvailabilityProtocol(from, daAddress common.Address) (*types.Transaction, error) {
2095
+ auth, err := etherMan.getAuthByAddress(from)
2096
+ if err != nil {
2097
+ return nil, err
2098
+ }
2099
+
2100
+ return etherMan.ZkEVM.SetDataAvailabilityProtocol(&auth, daAddress)
2101
+ }
2102
+
2103
+ // GetRollupId returns the rollup id
2104
+ func (etherMan *Client) GetRollupId() uint32 {
2105
+ return etherMan.RollupID
2106
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/etherman_test.go RENAMED
@@ -38,7 +38,7 @@
38
  }
39
 
40
  // This function prepare the blockchain, the wallet with funds and deploy the smc
41
- func newTestingEnv() (ethman *Client, ethBackend *simulated.Backend, auth *bind.TransactOpts, polAddr common.Address, br *polygonzkevmbridge.Polygonzkevmbridge) {
42
  privateKey, err := crypto.GenerateKey()
43
  if err != nil {
44
  log.Fatal(err)
@@ -47,7 +47,9 @@
47
  if err != nil {
48
  log.Fatal(err)
49
  }
50
- ethman, ethBackend, polAddr, br, err = NewSimulatedEtherman(Config{ForkIDChunkSize: 10}, auth)
 
 
51
  if err != nil {
52
  log.Fatal(err)
53
  }
@@ -55,12 +57,12 @@
55
  if err != nil {
56
  log.Fatal(err)
57
  }
58
- return ethman, ethBackend, auth, polAddr, br
59
  }
60
 
61
  func TestGEREvent(t *testing.T) {
62
  // Set up testing environment
63
- etherman, ethBackend, auth, _, br := newTestingEnv()
64
 
65
  // Read currentBlock
66
  ctx := context.Background()
@@ -82,14 +84,14 @@
82
  blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber)
83
  require.NoError(t, err)
84
  t.Logf("Blocks: %+v", blocks)
85
- assert.Equal(t, uint64(8), blocks[0].L1InfoTree[0].BlockNumber)
86
  assert.NotEqual(t, common.Hash{}, blocks[0].L1InfoTree[0].MainnetExitRoot)
87
  assert.Equal(t, common.Hash{}, blocks[0].L1InfoTree[0].RollupExitRoot)
88
  }
89
 
90
  func TestForcedBatchEvent(t *testing.T) {
91
  // Set up testing environment
92
- etherman, ethBackend, auth, _, _ := newTestingEnv()
93
 
94
  // Read currentBlock
95
  ctx := context.Background()
@@ -114,8 +116,8 @@
114
  blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber)
115
  require.NoError(t, err)
116
  t.Logf("Blocks: %+v", blocks)
117
- assert.Equal(t, uint64(8), blocks[0].BlockNumber)
118
- assert.Equal(t, uint64(8), blocks[0].ForcedBatches[0].BlockNumber)
119
  assert.NotEqual(t, common.Hash{}, blocks[0].ForcedBatches[0].GlobalExitRoot)
120
  assert.NotEqual(t, time.Time{}, blocks[0].ForcedBatches[0].ForcedAt)
121
  assert.Equal(t, uint64(1), blocks[0].ForcedBatches[0].ForcedBatchNumber)
@@ -125,7 +127,7 @@
125
 
126
  func TestSequencedBatchesEvent(t *testing.T) {
127
  // Set up testing environment
128
- etherman, ethBackend, auth, _, br := newTestingEnv()
129
 
130
  // Read currentBlock
131
  ctx := context.Background()
@@ -156,13 +158,19 @@
156
  blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &currentBlockNumber)
157
  require.NoError(t, err)
158
  t.Log("Blocks: ", blocks)
159
- var sequences []polygonzkevm.PolygonRollupBaseEtrogBatchData
160
- sequences = append(sequences, polygonzkevm.PolygonRollupBaseEtrogBatchData{
161
- Transactions: common.Hex2Bytes(rawTxs),
162
- }, polygonzkevm.PolygonRollupBaseEtrogBatchData{
163
- Transactions: common.Hex2Bytes(rawTxs),
 
164
  })
165
- _, err = etherman.ZkEVM.SequenceBatches(auth, sequences, uint64(time.Now().Unix()), uint64(1), auth.From)
 
 
 
 
 
166
  require.NoError(t, err)
167
 
168
  // Mine the tx in a block
@@ -188,7 +196,7 @@
188
 
189
  func TestVerifyBatchEvent(t *testing.T) {
190
  // Set up testing environment
191
- etherman, ethBackend, auth, _, _ := newTestingEnv()
192
 
193
  // Read currentBlock
194
  ctx := context.Background()
@@ -197,12 +205,13 @@
197
  require.NoError(t, err)
198
 
199
  rawTxs := "f84901843b9aca00827b0c945fbdb2315678afecb367f032d93f642f64180aa380a46057361d00000000000000000000000000000000000000000000000000000000000000048203e9808073efe1fa2d3e27f26f32208550ea9b0274d49050b816cadab05a771f4275d0242fd5d92b3fb89575c070e6c930587c520ee65a3aa8cfe382fcad20421bf51d621c"
200
- tx := polygonzkevm.PolygonRollupBaseEtrogBatchData{
201
- Transactions: common.Hex2Bytes(rawTxs),
202
  }
203
- //TODO: Fix params
204
- _, err = etherman.ZkEVM.SequenceBatches(auth, []polygonzkevm.PolygonRollupBaseEtrogBatchData{tx}, uint64(time.Now().Unix()), uint64(1), auth.From)
205
  require.NoError(t, err)
 
206
 
207
  // Mine the tx in a block
208
  ethBackend.Commit()
@@ -220,7 +229,7 @@
220
  blocks, order, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber)
221
  require.NoError(t, err)
222
  t.Logf("Blocks: %+v, \nOrder: %+v", blocks, order)
223
- assert.Equal(t, uint64(9), blocks[1].BlockNumber)
224
  assert.Equal(t, uint64(1), blocks[1].VerifiedBatches[0].BatchNumber)
225
  assert.NotEqual(t, common.Address{}, blocks[1].VerifiedBatches[0].Aggregator)
226
  assert.NotEqual(t, common.Hash{}, blocks[1].VerifiedBatches[0].TxHash)
@@ -232,7 +241,7 @@
232
 
233
  func TestSequenceForceBatchesEvent(t *testing.T) {
234
  // Set up testing environment
235
- etherman, ethBackend, auth, _, _ := newTestingEnv()
236
 
237
  // Read currentBlock
238
  ctx := context.Background()
@@ -283,7 +292,7 @@
283
  blocks, order, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber)
284
  require.NoError(t, err)
285
  t.Logf("Blocks: %+v", blocks)
286
- assert.Equal(t, uint64(12), blocks[1].BlockNumber)
287
  assert.Equal(t, uint64(2), blocks[1].SequencedForceBatches[0][0].BatchNumber)
288
  assert.Equal(t, forcedGer, common.BytesToHash(blocks[1].SequencedForceBatches[0][0].ForcedGlobalExitRoot[:]))
289
  assert.Equal(t, forcedTimestamp, blocks[1].SequencedForceBatches[0][0].ForcedTimestamp)
@@ -293,7 +302,7 @@
293
 
294
  func TestSendSequences(t *testing.T) {
295
  // Set up testing environment
296
- etherman, ethBackend, auth, _, br := newTestingEnv()
297
 
298
  // Read currentBlock
299
  ctx := context.Background()
@@ -315,10 +324,12 @@
315
  BatchL2Data: batchL2Data,
316
  LastL2BLockTimestamp: time.Now().Unix(),
317
  }
 
318
  lastL2BlockTStamp := tx1.Time().Unix()
319
- // TODO: fix params
320
- tx, err := etherman.sequenceBatches(*auth, []ethmanTypes.Sequence{sequence}, uint64(lastL2BlockTStamp), uint64(1), auth.From)
321
  require.NoError(t, err)
 
 
322
  log.Debug("TX: ", tx.Hash())
323
  ethBackend.Commit()
324
 
@@ -341,7 +352,7 @@
341
 
342
  func TestGasPrice(t *testing.T) {
343
  // Set up testing environment
344
- etherman, _, _, _, _ := newTestingEnv()
345
  etherscanM := new(etherscanMock)
346
  ethGasStationM := new(ethGasStationMock)
347
  etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM}
@@ -360,14 +371,14 @@
360
 
361
  func TestErrorEthGasStationPrice(t *testing.T) {
362
  // Set up testing environment
363
- etherman, _, _, _, _ := newTestingEnv()
364
  ethGasStationM := new(ethGasStationMock)
365
  etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, ethGasStationM}
366
  ctx := context.Background()
367
 
368
  ethGasStationM.On("SuggestGasPrice", ctx).Return(big.NewInt(0), fmt.Errorf("error getting gasPrice from ethGasStation"))
369
  gp := etherman.GetL1GasPrice(ctx)
370
- assert.Equal(t, big.NewInt(1392695906), gp)
371
 
372
  etherscanM := new(etherscanMock)
373
  etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM}
@@ -379,7 +390,7 @@
379
 
380
  func TestErrorEtherScanPrice(t *testing.T) {
381
  // Set up testing environment
382
- etherman, _, _, _, _ := newTestingEnv()
383
  etherscanM := new(etherscanMock)
384
  ethGasStationM := new(ethGasStationMock)
385
  etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM}
@@ -393,7 +404,7 @@
393
 
394
  func TestGetForks(t *testing.T) {
395
  // Set up testing environment
396
- etherman, _, _, _, _ := newTestingEnv()
397
  ctx := context.Background()
398
  forks, err := etherman.GetForks(ctx, 0, 132)
399
  require.NoError(t, err)
 
38
  }
39
 
40
  // This function prepare the blockchain, the wallet with funds and deploy the smc
41
+ func newTestingEnv(t *testing.T) (ethman *Client, ethBackend *simulated.Backend, auth *bind.TransactOpts, polAddr common.Address, br *polygonzkevmbridge.Polygonzkevmbridge, da *daMock, st *stateMock) {
42
  privateKey, err := crypto.GenerateKey()
43
  if err != nil {
44
  log.Fatal(err)
 
47
  if err != nil {
48
  log.Fatal(err)
49
  }
50
+ da = newDaMock(t)
51
+ st = newStateMock(t)
52
+ ethman, ethBackend, polAddr, br, err = NewSimulatedEtherman(Config{ForkIDChunkSize: 10}, auth, da, st)
53
  if err != nil {
54
  log.Fatal(err)
55
  }
 
57
  if err != nil {
58
  log.Fatal(err)
59
  }
60
+ return ethman, ethBackend, auth, polAddr, br, da, st
61
  }
62
 
63
  func TestGEREvent(t *testing.T) {
64
  // Set up testing environment
65
+ etherman, ethBackend, auth, _, br, _, _ := newTestingEnv(t)
66
 
67
  // Read currentBlock
68
  ctx := context.Background()
 
84
  blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber)
85
  require.NoError(t, err)
86
  t.Logf("Blocks: %+v", blocks)
87
+ assert.Equal(t, uint64(11), blocks[0].L1InfoTree[0].BlockNumber)
88
  assert.NotEqual(t, common.Hash{}, blocks[0].L1InfoTree[0].MainnetExitRoot)
89
  assert.Equal(t, common.Hash{}, blocks[0].L1InfoTree[0].RollupExitRoot)
90
  }
91
 
92
  func TestForcedBatchEvent(t *testing.T) {
93
  // Set up testing environment
94
+ etherman, ethBackend, auth, _, _, _, _ := newTestingEnv(t)
95
 
96
  // Read currentBlock
97
  ctx := context.Background()
 
116
  blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber)
117
  require.NoError(t, err)
118
  t.Logf("Blocks: %+v", blocks)
119
+ assert.Equal(t, uint64(11), blocks[0].BlockNumber)
120
+ assert.Equal(t, uint64(11), blocks[0].ForcedBatches[0].BlockNumber)
121
  assert.NotEqual(t, common.Hash{}, blocks[0].ForcedBatches[0].GlobalExitRoot)
122
  assert.NotEqual(t, time.Time{}, blocks[0].ForcedBatches[0].ForcedAt)
123
  assert.Equal(t, uint64(1), blocks[0].ForcedBatches[0].ForcedBatchNumber)
 
127
 
128
  func TestSequencedBatchesEvent(t *testing.T) {
129
  // Set up testing environment
130
+ etherman, ethBackend, auth, _, br, da, _ := newTestingEnv(t)
131
 
132
  // Read currentBlock
133
  ctx := context.Background()
 
158
  blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &currentBlockNumber)
159
  require.NoError(t, err)
160
  t.Log("Blocks: ", blocks)
161
+ var sequences []polygonzkevm.PolygonValidiumEtrogValidiumBatchData
162
+ txsHash := crypto.Keccak256Hash(common.Hex2Bytes(rawTxs))
163
+ sequences = append(sequences, polygonzkevm.PolygonValidiumEtrogValidiumBatchData{
164
+ TransactionsHash: txsHash,
165
+ }, polygonzkevm.PolygonValidiumEtrogValidiumBatchData{
166
+ TransactionsHash: txsHash,
167
  })
168
+ batchNums := []uint64{2, 3}
169
+ batchHashes := []common.Hash{txsHash, txsHash}
170
+ batchData := [][]byte{data, data}
171
+ daMessage, _ := hex.DecodeString("0x123456789123456789")
172
+ da.Mock.On("GetBatchL2Data", batchNums, batchHashes, daMessage).Return(batchData, nil)
173
+ _, err = etherman.ZkEVM.SequenceBatchesValidium(auth, sequences, uint64(time.Now().Unix()), uint64(1), auth.From, daMessage)
174
  require.NoError(t, err)
175
 
176
  // Mine the tx in a block
 
196
 
197
  func TestVerifyBatchEvent(t *testing.T) {
198
  // Set up testing environment
199
+ etherman, ethBackend, auth, _, _, da, _ := newTestingEnv(t)
200
 
201
  // Read currentBlock
202
  ctx := context.Background()
 
205
  require.NoError(t, err)
206
 
207
  rawTxs := "f84901843b9aca00827b0c945fbdb2315678afecb367f032d93f642f64180aa380a46057361d00000000000000000000000000000000000000000000000000000000000000048203e9808073efe1fa2d3e27f26f32208550ea9b0274d49050b816cadab05a771f4275d0242fd5d92b3fb89575c070e6c930587c520ee65a3aa8cfe382fcad20421bf51d621c"
208
+ tx := polygonzkevm.PolygonValidiumEtrogValidiumBatchData{
209
+ TransactionsHash: crypto.Keccak256Hash(common.Hex2Bytes(rawTxs)),
210
  }
211
+ daMessage, _ := hex.DecodeString("0x1234")
212
+ _, err = etherman.ZkEVM.SequenceBatchesValidium(auth, []polygonzkevm.PolygonValidiumEtrogValidiumBatchData{tx}, uint64(time.Now().Unix()), uint64(1), auth.From, daMessage)
213
  require.NoError(t, err)
214
+ da.Mock.On("GetBatchL2Data", []uint64{2}, []common.Hash{crypto.Keccak256Hash(common.Hex2Bytes(rawTxs))}, daMessage).Return([][]byte{common.Hex2Bytes(rawTxs)}, nil)
215
 
216
  // Mine the tx in a block
217
  ethBackend.Commit()
 
229
  blocks, order, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber)
230
  require.NoError(t, err)
231
  t.Logf("Blocks: %+v, \nOrder: %+v", blocks, order)
232
+ assert.Equal(t, uint64(12), blocks[1].BlockNumber)
233
  assert.Equal(t, uint64(1), blocks[1].VerifiedBatches[0].BatchNumber)
234
  assert.NotEqual(t, common.Address{}, blocks[1].VerifiedBatches[0].Aggregator)
235
  assert.NotEqual(t, common.Hash{}, blocks[1].VerifiedBatches[0].TxHash)
 
241
 
242
  func TestSequenceForceBatchesEvent(t *testing.T) {
243
  // Set up testing environment
244
+ etherman, ethBackend, auth, _, _, _, _ := newTestingEnv(t)
245
 
246
  // Read currentBlock
247
  ctx := context.Background()
 
292
  blocks, order, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber)
293
  require.NoError(t, err)
294
  t.Logf("Blocks: %+v", blocks)
295
+ assert.Equal(t, uint64(15), blocks[1].BlockNumber)
296
  assert.Equal(t, uint64(2), blocks[1].SequencedForceBatches[0][0].BatchNumber)
297
  assert.Equal(t, forcedGer, common.BytesToHash(blocks[1].SequencedForceBatches[0][0].ForcedGlobalExitRoot[:]))
298
  assert.Equal(t, forcedTimestamp, blocks[1].SequencedForceBatches[0][0].ForcedTimestamp)
 
302
 
303
  func TestSendSequences(t *testing.T) {
304
  // Set up testing environment
305
+ etherman, ethBackend, auth, _, br, da, _ := newTestingEnv(t)
306
 
307
  // Read currentBlock
308
  ctx := context.Background()
 
324
  BatchL2Data: batchL2Data,
325
  LastL2BLockTimestamp: time.Now().Unix(),
326
  }
327
+ daMessage, _ := hex.DecodeString("0x1234")
328
  lastL2BlockTStamp := tx1.Time().Unix()
329
+ tx, err := etherman.sequenceBatches(*auth, []ethmanTypes.Sequence{sequence}, uint64(lastL2BlockTStamp), uint64(1), auth.From, daMessage)
 
330
  require.NoError(t, err)
331
+ da.Mock.On("GetBatchL2Data", []uint64{2}, []common.Hash{crypto.Keccak256Hash(batchL2Data)}, daMessage).Return([][]byte{batchL2Data}, nil)
332
+
333
  log.Debug("TX: ", tx.Hash())
334
  ethBackend.Commit()
335
 
 
352
 
353
  func TestGasPrice(t *testing.T) {
354
  // Set up testing environment
355
+ etherman, _, _, _, _, _, _ := newTestingEnv(t)
356
  etherscanM := new(etherscanMock)
357
  ethGasStationM := new(ethGasStationMock)
358
  etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM}
 
371
 
372
  func TestErrorEthGasStationPrice(t *testing.T) {
373
  // Set up testing environment
374
+ etherman, _, _, _, _, _, _ := newTestingEnv(t)
375
  ethGasStationM := new(ethGasStationMock)
376
  etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, ethGasStationM}
377
  ctx := context.Background()
378
 
379
  ethGasStationM.On("SuggestGasPrice", ctx).Return(big.NewInt(0), fmt.Errorf("error getting gasPrice from ethGasStation"))
380
  gp := etherman.GetL1GasPrice(ctx)
381
+ assert.Equal(t, big.NewInt(1263075579), gp)
382
 
383
  etherscanM := new(etherscanMock)
384
  etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM}
 
390
 
391
  func TestErrorEtherScanPrice(t *testing.T) {
392
  // Set up testing environment
393
+ etherman, _, _, _, _, _, _ := newTestingEnv(t)
394
  etherscanM := new(etherscanMock)
395
  ethGasStationM := new(ethGasStationMock)
396
  etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM}
 
404
 
405
  func TestGetForks(t *testing.T) {
406
  // Set up testing environment
407
+ etherman, _, _, _, _, _, _ := newTestingEnv(t)
408
  ctx := context.Background()
409
  forks, err := etherman.GetForks(ctx, 0, 132)
410
  require.NoError(t, err)
{/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/interfaces.go RENAMED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package etherman
2
+
3
+ import (
4
+ "context"
5
+
6
+ "github.com/ethereum/go-ethereum/common"
7
+ "github.com/jackc/pgx/v4"
8
+ )
9
+
10
+ type dataAvailabilityProvider interface {
11
+ GetBatchL2Data(batchNum []uint64, hash []common.Hash, dataAvailabilityMessage []byte) ([][]byte, error)
12
+ }
13
+
14
+ type stateProvider interface {
15
+ GetForcedBatchDataByNumbers(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error)
16
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/simulated.go RENAMED
@@ -23,7 +24,7 @@
23
 
24
  // NewSimulatedEtherman creates an etherman that uses a simulated blockchain. It's important to notice that the ChainID of the auth
25
  // must be 1337. The address that holds the auth will have an initial balance of 10 ETH
26
- func NewSimulatedEtherman(cfg Config, auth *bind.TransactOpts) (*Client, *simulated.Backend, common.Address, *polygonzkevmbridge.Polygonzkevmbridge, error) {
27
  if auth == nil {
28
  // read only client
29
  return &Client{}, nil, common.Address{}, nil, nil
@@ -37,8 +38,26 @@
37
  },
38
  }
39
  blockGasLimit := uint64(999999999999999999) //nolint:gomnd
 
40
  client := simulated.NewBackend(genesisAlloc, simulated.WithBlockGasLimit(blockGasLimit))
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  // Deploy contracts
43
  const polDecimalPlaces = 18
44
  totalSupply, _ := new(big.Int).SetString("10000000000000000000000000000", 10) //nolint:gomnd
@@ -102,7 +121,7 @@
102
  log.Error("error: ", err)
103
  return nil, nil, common.Address{}, nil, err
104
  }
105
- br, err := polygonzkevmbridge.NewPolygonzkevmbridge(bridgeAddr, client.Client())
106
  if err != nil {
107
  log.Error("error: ", err)
108
  return nil, nil, common.Address{}, nil, err
@@ -182,6 +201,11 @@
182
  return nil, nil, common.Address{}, nil, err
183
  }
184
 
 
 
 
 
 
185
  _, err = trueZkevm.SetForceBatchAddress(auth, common.Address{})
186
  if err != nil {
187
  log.Error("error: ", err)
@@ -199,6 +223,8 @@
199
  SCAddresses: []common.Address{zkevmAddr, mockRollupManagerAddr, exitManagerAddr},
200
  auth: map[common.Address]bind.TransactOpts{},
201
  cfg: cfg,
 
 
202
  }
203
  err = c.AddOrReplaceAuth(*auth)
204
  if err != nil {
 
24
 
25
  // NewSimulatedEtherman creates an etherman that uses a simulated blockchain. It's important to notice that the ChainID of the auth
26
  // must be 1337. The address that holds the auth will have an initial balance of 10 ETH
27
+ func NewSimulatedEtherman(cfg Config, auth *bind.TransactOpts, daBackend dataAvailabilityProvider, st stateProvider) (etherman *Client, ethBackend *simulated.Backend, polAddr common.Address, br *polygonzkevmbridge.Polygonzkevmbridge, err error) {
28
  if auth == nil {
29
  // read only client
30
  return &Client{}, nil, common.Address{}, nil, nil
 
38
  },
39
  }
40
  blockGasLimit := uint64(999999999999999999) //nolint:gomnd
41
+ // client := simulated.NewBackend(genesisAlloc, simulated.WithBlockGasLimit(blockGasLimit))
42
  client := simulated.NewBackend(genesisAlloc, simulated.WithBlockGasLimit(blockGasLimit))
43
 
44
+ // DAC Setup
45
+ daAddr, _, da, err := polygondatacommittee.DeployPolygondatacommittee(auth, client.Client())
46
+ if err != nil {
47
+ return nil, nil, common.Address{}, nil, err
48
+ }
49
+ client.Commit()
50
+ _, err = da.Initialize(auth)
51
+ if err != nil {
52
+ return nil, nil, common.Address{}, nil, err
53
+ }
54
+ client.Commit()
55
+ _, err = da.SetupCommittee(auth, big.NewInt(0), []string{}, []byte{})
56
+ if err != nil {
57
+ return nil, nil, common.Address{}, nil, err
58
+ }
59
+ client.Commit()
60
+
61
  // Deploy contracts
62
  const polDecimalPlaces = 18
63
  totalSupply, _ := new(big.Int).SetString("10000000000000000000000000000", 10) //nolint:gomnd
 
121
  log.Error("error: ", err)
122
  return nil, nil, common.Address{}, nil, err
123
  }
124
+ br, err = polygonzkevmbridge.NewPolygonzkevmbridge(bridgeAddr, client.Client())
125
  if err != nil {
126
  log.Error("error: ", err)
127
  return nil, nil, common.Address{}, nil, err
 
201
  return nil, nil, common.Address{}, nil, err
202
  }
203
 
204
+ _, err = trueZkevm.SetDataAvailabilityProtocol(auth, daAddr)
205
+ if err != nil {
206
+ log.Error("error: ", err)
207
+ return nil, nil, common.Address{}, nil, err
208
+ }
209
  _, err = trueZkevm.SetForceBatchAddress(auth, common.Address{})
210
  if err != nil {
211
  log.Error("error: ", err)
 
223
  SCAddresses: []common.Address{zkevmAddr, mockRollupManagerAddr, exitManagerAddr},
224
  auth: map[common.Address]bind.TransactOpts{},
225
  cfg: cfg,
226
+ da: daBackend,
227
+ state: st,
228
  }
229
  err = c.AddOrReplaceAuth(*auth)
230
  if err != nil {
{/home/stefan/go/src/Polygon/zkevm-node → .}/event/event.go RENAMED
@@ -42,6 +42,9 @@
42
  EventID_SynchronizerHalt EventID = "SYNCHRONIZER HALT"
43
  // EventID_SequenceSenderHalt is triggered when the SequenceSender halts
44
  EventID_SequenceSenderHalt EventID = "SEQUENCESENDER HALT"
 
 
 
45
  // EventID_NodeOOC is triggered when an OOC at node level is detected
46
  EventID_NodeOOC EventID = "NODE OOC"
47
  // EventID_UsedZKCountersOverflow is triggered when used ZK counters exceeds remaining batch ZK counters
 
42
  EventID_SynchronizerHalt EventID = "SYNCHRONIZER HALT"
43
  // EventID_SequenceSenderHalt is triggered when the SequenceSender halts
44
  EventID_SequenceSenderHalt EventID = "SEQUENCESENDER HALT"
45
+ // EventID_UnsupportedPrecompile is triggered when the executor returns an unsupported precompile error
46
+ EventID_UnsupportedPrecompile EventID = "UNSUPPORTED PRECOMPILE"
47
+
48
  // EventID_NodeOOC is triggered when an OOC at node level is detected
49
  EventID_NodeOOC EventID = "NODE OOC"
50
  // EventID_UsedZKCountersOverflow is triggered when used ZK counters exceeds remaining batch ZK counters
{/home/stefan/go/src/Polygon/zkevm-node → .}/.golangci.yml RENAMED
@@ -30,3 +30,6 @@
30
  include:
31
  - EXC0012 # EXC0012 revive: Annoying issue about not having a comment. The rare codebase has such comments
32
  - EXC0014 # EXC0014 revive: Annoying issue about not having a comment. The rare codebase has such comments
 
 
 
 
30
  include:
31
  - EXC0012 # EXC0012 revive: Annoying issue about not having a comment. The rare codebase has such comments
32
  - EXC0014 # EXC0014 revive: Annoying issue about not having a comment. The rare codebase has such comments
33
+ exclude-rules:
34
+ - path: cmd/policy.go
35
+ text: "unused"
{/home/stefan/go/src/Polygon/zkevm-node → .}/go.mod RENAMED
@@ -22,9 +22,9 @@
22
  github.com/prometheus/common v0.45.0
23
  github.com/rubenv/sql-migrate v1.6.1
24
  github.com/spf13/afero v1.11.0
25
- github.com/spf13/viper v1.17.0
26
  github.com/stretchr/testify v1.8.4
27
- github.com/umbracle/ethgo v0.1.3
28
  github.com/urfave/cli/v2 v2.26.0
29
  go.uber.org/zap v1.26.0
30
  golang.org/x/crypto v0.18.0
@@ -45,7 +45,7 @@
45
  github.com/VictoriaMetrics/fastcache v1.12.1 // indirect
46
  github.com/bahlo/generic-list-go v0.2.0 // indirect
47
  github.com/beorn7/perks v1.0.1 // indirect
48
- github.com/bits-and-blooms/bitset v1.10.0 // indirect
49
  github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
50
  github.com/buger/jsonparser v1.1.1 // indirect
51
  github.com/cespare/xxhash/v2 v2.2.0 // indirect
@@ -63,12 +63,12 @@
63
  github.com/cyphar/filepath-securejoin v0.2.4 // indirect
64
  github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
65
  github.com/deckarep/golang-set/v2 v2.1.0 // indirect
66
- github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
67
  github.com/dlclark/regexp2 v1.7.0 // indirect
68
  github.com/emirpasic/gods v1.18.1 // indirect
69
  github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
70
  github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect
71
- github.com/fsnotify/fsnotify v1.6.0 // indirect
72
  github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect
73
  github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect
74
  github.com/getsentry/sentry-go v0.18.0 // indirect
@@ -101,6 +101,7 @@
101
  github.com/jackc/puddle v1.3.0 // indirect
102
  github.com/jackpal/go-nat-pmp v1.0.2 // indirect
103
  github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
 
104
  github.com/karrick/godirwalk v1.17.0 // indirect
105
  github.com/kevinburke/ssh_config v1.2.0 // indirect
106
  github.com/klauspost/compress v1.17.0 // indirect
@@ -116,6 +117,7 @@
116
  github.com/mattn/go-isatty v0.0.20 // indirect
117
  github.com/mattn/go-runewidth v0.0.13 // indirect
118
  github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
 
119
  github.com/mitchellh/pointerstructure v1.2.0 // indirect
120
  github.com/mmcloughlin/addchain v0.4.0 // indirect
121
  github.com/olekukonko/tablewriter v0.0.5 // indirect
@@ -128,14 +130,14 @@
128
  github.com/rogpeppe/go-internal v1.11.0 // indirect
129
  github.com/rs/cors v1.7.0 // indirect
130
  github.com/russross/blackfriday/v2 v2.1.0 // indirect
131
- github.com/sagikazarmark/locafero v0.3.0 // indirect
132
  github.com/sagikazarmark/slog-shim v0.1.0 // indirect
133
  github.com/sergi/go-diff v1.2.0 // indirect
134
  github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
135
  github.com/sirupsen/logrus v1.9.0 // indirect
136
  github.com/skeema/knownhosts v1.2.1 // indirect
137
  github.com/sourcegraph/conc v0.3.0 // indirect
138
- github.com/spf13/cast v1.5.1 // indirect
139
  github.com/spf13/pflag v1.0.5 // indirect
140
  github.com/status-im/keycard-go v0.2.0 // indirect
141
  github.com/stretchr/objx v0.5.0 // indirect
 
22
  github.com/prometheus/common v0.45.0
23
  github.com/rubenv/sql-migrate v1.6.1
24
  github.com/spf13/afero v1.11.0
25
+ github.com/spf13/viper v1.18.2
26
  github.com/stretchr/testify v1.8.4
27
+ github.com/umbracle/ethgo v0.1.4-0.20230712173909-df37dddf16f0
28
  github.com/urfave/cli/v2 v2.26.0
29
  go.uber.org/zap v1.26.0
30
  golang.org/x/crypto v0.18.0
 
45
  github.com/VictoriaMetrics/fastcache v1.12.1 // indirect
46
  github.com/bahlo/generic-list-go v0.2.0 // indirect
47
  github.com/beorn7/perks v1.0.1 // indirect
48
+ github.com/bits-and-blooms/bitset v1.12.0 // indirect
49
  github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
50
  github.com/buger/jsonparser v1.1.1 // indirect
51
  github.com/cespare/xxhash/v2 v2.2.0 // indirect
 
63
  github.com/cyphar/filepath-securejoin v0.2.4 // indirect
64
  github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
65
  github.com/deckarep/golang-set/v2 v2.1.0 // indirect
66
+ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
67
  github.com/dlclark/regexp2 v1.7.0 // indirect
68
  github.com/emirpasic/gods v1.18.1 // indirect
69
  github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
70
  github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect
71
+ github.com/fsnotify/fsnotify v1.7.0 // indirect
72
  github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect
73
  github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect
74
  github.com/getsentry/sentry-go v0.18.0 // indirect
 
101
  github.com/jackc/puddle v1.3.0 // indirect
102
  github.com/jackpal/go-nat-pmp v1.0.2 // indirect
103
  github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
104
+ github.com/jmoiron/sqlx v1.2.0 // indirect
105
  github.com/karrick/godirwalk v1.17.0 // indirect
106
  github.com/kevinburke/ssh_config v1.2.0 // indirect
107
  github.com/klauspost/compress v1.17.0 // indirect
 
117
  github.com/mattn/go-isatty v0.0.20 // indirect
118
  github.com/mattn/go-runewidth v0.0.13 // indirect
119
  github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
120
+ github.com/miguelmota/go-solidity-sha3 v0.1.1 // indirect
121
  github.com/mitchellh/pointerstructure v1.2.0 // indirect
122
  github.com/mmcloughlin/addchain v0.4.0 // indirect
123
  github.com/olekukonko/tablewriter v0.0.5 // indirect
 
130
  github.com/rogpeppe/go-internal v1.11.0 // indirect
131
  github.com/rs/cors v1.7.0 // indirect
132
  github.com/russross/blackfriday/v2 v2.1.0 // indirect
133
+ github.com/sagikazarmark/locafero v0.4.0 // indirect
134
  github.com/sagikazarmark/slog-shim v0.1.0 // indirect
135
  github.com/sergi/go-diff v1.2.0 // indirect
136
  github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
137
  github.com/sirupsen/logrus v1.9.0 // indirect
138
  github.com/skeema/knownhosts v1.2.1 // indirect
139
  github.com/sourcegraph/conc v0.3.0 // indirect
140
+ github.com/spf13/cast v1.6.0 // indirect
141
  github.com/spf13/pflag v1.0.5 // indirect
142
  github.com/status-im/keycard-go v0.2.0 // indirect
143
  github.com/stretchr/objx v0.5.0 // indirect
{/home/stefan/go/src/Polygon/zkevm-node → .}/.goreleaser-cdk.yaml RENAMED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # .goreleaser-cdk.yaml
2
+ project_name: cdk-validium-node
3
+
4
+ release:
5
+ disable: false
6
+ draft: true
7
+ prerelease: auto
8
+
9
+ before:
10
+ hooks:
11
+ - go mod download
12
+ - go install github.com/gobuffalo/packr/v2/packr2@v2.8.3
13
+ - packr2
14
+
15
+ builds:
16
+ - main: ./cmd/
17
+ binary: zkevm-node
18
+ goos:
19
+ - linux
20
+ - darwin
21
+ goarch:
22
+ - amd64
23
+ - arm64
24
+ env:
25
+ - CGO_ENABLED=0
26
+ ldflags:
27
+ - -s -w
28
+ - -X github.com/0xPolygonHermez/zkevm-node.Version={{ .Version }}
29
+ - -X github.com/0xPolygonHermez/zkevm-node.GitRev={{ .Commit }}
30
+ - -X github.com/0xPolygonHermez/zkevm-node.BuildDate={{ .Date }}
31
+ - -X github.com/0xPolygonHermez/zkevm-node.GitBranch={{ .Branch }}
32
+
33
+ archives:
34
+ - files:
35
+ - LICENSE
36
+ - README.md
37
+
38
+ dockers:
39
+ - image_templates:
40
+ - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-amd64
41
+ dockerfile: Dockerfile.release
42
+ use: buildx
43
+ goos: linux
44
+ goarch: amd64
45
+ build_flag_templates:
46
+ - --platform=linux/amd64
47
+ - --label=org.opencontainers.image.title={{ .ProjectName }}
48
+ - --label=org.opencontainers.image.description={{ .ProjectName }}
49
+ - --label=org.opencontainers.image.url=https://github.com/{{ .ProjectName }}
50
+ - --label=org.opencontainers.image.source=https://github.com/{{ .ProjectName }}
51
+ - --label=org.opencontainers.image.version={{ replace .Version "+" "-" }}
52
+ - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
53
+ - --label=org.opencontainers.image.revision={{ .FullCommit }}
54
+ skip_push: false
55
+
56
+ - image_templates:
57
+ - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-arm64
58
+ dockerfile: Dockerfile.release
59
+ use: buildx
60
+ goos: linux
61
+ goarch: arm64
62
+ build_flag_templates:
63
+ - --platform=linux/arm64
64
+ - --label=org.opencontainers.image.title={{ .ProjectName }}
65
+ - --label=org.opencontainers.image.description={{ .ProjectName }}
66
+ - --label=org.opencontainers.image.url=https://github.com/{{ .ProjectName }}
67
+ - --label=org.opencontainers.image.source=https://github.com/{{ .ProjectName }}
68
+ - --label=org.opencontainers.image.version={{ replace .Version "+" "-" }}
69
+ - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
70
+ - --label=org.opencontainers.image.revision={{ .FullCommit }}
71
+ skip_push: false
72
+
73
+ docker_manifests:
74
+ - name_template: 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}
75
+ image_templates:
76
+ - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-amd64
77
+ - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-arm64
78
+ skip_push: false
79
+
80
+ - name_template: 0xpolygon/{{ .ProjectName }}:latest
81
+ image_templates:
82
+ - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-amd64
83
+ - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-arm64
84
+ skip_push: false
{/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/client/zkevm.go RENAMED
@@ -58,6 +58,46 @@
58
  return result, nil
59
  }
60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  // ExitRootsByGER returns the exit roots accordingly to the provided Global Exit Root
62
  func (c *Client) ExitRootsByGER(ctx context.Context, globalExitRoot common.Hash) (*types.ExitRoots, error) {
63
  response, err := JSONRPCCall(c.url, "zkevm_getExitRootsByGER", globalExitRoot.String())
 
58
  return result, nil
59
  }
60
 
61
+ // BatchesByNumbers returns batches from the current canonical chain by batch numbers. If the list is empty, the last
62
+ // known batch is returned as a list.
63
+ func (c *Client) BatchesByNumbers(ctx context.Context, numbers []*big.Int) ([]*types.BatchData, error) {
64
+ return c.batchesByNumbers(ctx, numbers, "zkevm_getBatchDataByNumbers")
65
+ }
66
+
67
+ // ForcedBatchesByNumbers returns forced batches data.
68
+ func (c *Client) ForcedBatchesByNumbers(ctx context.Context, numbers []*big.Int) ([]*types.BatchData, error) {
69
+ return c.batchesByNumbers(ctx, numbers, "zkevm_getForcedBatchDataByNumbers")
70
+ }
71
+
72
+ // BatchesByNumbers returns batches from the current canonical chain by batch numbers. If the list is empty, the last
73
+ // known batch is returned as a list.
74
+ func (c *Client) batchesByNumbers(_ context.Context, numbers []*big.Int, method string) ([]*types.BatchData, error) {
75
+ batchNumbers := make([]types.BatchNumber, 0, len(numbers))
76
+ for _, n := range numbers {
77
+ batchNumbers = append(batchNumbers, types.BatchNumber(n.Int64()))
78
+ }
79
+ if len(batchNumbers) == 0 {
80
+ batchNumbers = append(batchNumbers, types.LatestBatchNumber)
81
+ }
82
+
83
+ response, err := JSONRPCCall(c.url, method, &types.BatchFilter{Numbers: batchNumbers})
84
+ if err != nil {
85
+ return nil, err
86
+ }
87
+
88
+ if response.Error != nil {
89
+ return nil, response.Error.RPCError()
90
+ }
91
+
92
+ var result *types.BatchDataResult
93
+ err = json.Unmarshal(response.Result, &result)
94
+ if err != nil {
95
+ return nil, err
96
+ }
97
+
98
+ return result.Data, nil
99
+ }
100
+
101
  // ExitRootsByGER returns the exit roots accordingly to the provided Global Exit Root
102
  func (c *Client) ExitRootsByGER(ctx context.Context, globalExitRoot common.Hash) (*types.ExitRoots, error) {
103
  response, err := JSONRPCCall(c.url, "zkevm_getExitRootsByGER", globalExitRoot.String())
{/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/endpoints_eth.go RENAMED
@@ -927,6 +927,9 @@
927
  if e.cfg.SequencerNodeURI != "" {
928
  return e.relayTxToSequencerNode(input)
929
  } else {
 
 
 
930
  ip := ""
931
  ips := httpRequest.Header.Get("X-Forwarded-For")
932
 
 
927
  if e.cfg.SequencerNodeURI != "" {
928
  return e.relayTxToSequencerNode(input)
929
  } else {
930
+ if err := checkPolicy(context.Background(), e.pool, input); err != nil {
931
+ return RPCErrorResponse(types.AccessDeniedCode, err.Error(), nil, false)
932
+ }
933
  ip := ""
934
  ips := httpRequest.Header.Get("X-Forwarded-For")
935
 
{/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/endpoints_eth_test.go RENAMED
@@ -6,6 +6,7 @@
6
  "errors"
7
  "fmt"
8
  "math/big"
 
9
  "sync"
10
  "testing"
11
  "time"
@@ -4574,3 +4575,237 @@
4574
  assert.ElementsMatch(t, []int{13, 14, 15}, results[4])
4575
  assert.ElementsMatch(t, []int{16}, results[5])
4576
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  "errors"
7
  "fmt"
8
  "math/big"
9
+ "strings"
10
  "sync"
11
  "testing"
12
  "time"
 
4575
  assert.ElementsMatch(t, []int{13, 14, 15}, results[4])
4576
  assert.ElementsMatch(t, []int{16}, results[5])
4577
  }
4578
+
4579
+ func TestSendRawTransactionJSONRPCCallWithPolicyApplied(t *testing.T) {
4580
+ // Set up the sender
4581
+ allowedPrivateKey, err := crypto.HexToECDSA(strings.TrimPrefix("0x28b2b0318721be8c8339199172cd7cc8f5e273800a35616ec893083a4b32c02e", "0x"))
4582
+ require.NoError(t, err)
4583
+ allowed, err := bind.NewKeyedTransactorWithChainID(allowedPrivateKey, big.NewInt(1))
4584
+ require.NoError(t, err)
4585
+
4586
+ disallowedPrivateKey, err := crypto.HexToECDSA(strings.TrimPrefix("0xdeadbeef8721be8c8339199172cd7cc8f5e273800a35616ec893083a4b32c02e", "0x"))
4587
+ require.NoError(t, err)
4588
+ disallowed, err := bind.NewKeyedTransactorWithChainID(disallowedPrivateKey, big.NewInt(1))
4589
+ require.NoError(t, err)
4590
+ require.NotNil(t, disallowed)
4591
+
4592
+ allowedContract := common.HexToAddress("0x1")
4593
+ disallowedContract := common.HexToAddress("0x2")
4594
+
4595
+ senderDenied := types.NewRPCError(types.AccessDeniedCode, "sender disallowed send_tx by policy")
4596
+ contractDenied := types.NewRPCError(types.AccessDeniedCode, "contract disallowed send_tx by policy")
4597
+ deployDenied := types.NewRPCError(types.AccessDeniedCode, "sender disallowed deploy by policy")
4598
+
4599
+ cfg := getSequencerDefaultConfig()
4600
+ s, m, _ := newMockedServerWithCustomConfig(t, cfg)
4601
+ defer s.Stop()
4602
+
4603
+ type testCase struct {
4604
+ Name string
4605
+ Input string
4606
+ ExpectedResult *common.Hash
4607
+ ExpectedError types.Error
4608
+ Prepare func(t *testing.T, tc *testCase)
4609
+ SetupMocks func(t *testing.T, m *mocksWrapper, tc testCase)
4610
+ }
4611
+
4612
+ testCases := []testCase{
4613
+ {
4614
+ Name: "Sender & contract on allow list, accepted",
4615
+ Prepare: func(t *testing.T, tc *testCase) {
4616
+ tx := ethTypes.NewTransaction(1, allowedContract, big.NewInt(1), uint64(1), big.NewInt(1), []byte{})
4617
+
4618
+ signedTx, err := allowed.Signer(allowed.From, tx)
4619
+ require.NoError(t, err)
4620
+
4621
+ txBinary, err := signedTx.MarshalBinary()
4622
+ require.NoError(t, err)
4623
+
4624
+ rawTx := hex.EncodeToHex(txBinary)
4625
+ require.NoError(t, err)
4626
+
4627
+ tc.Input = rawTx
4628
+ expectedHash := signedTx.Hash()
4629
+ tc.ExpectedResult = &expectedHash
4630
+ tc.ExpectedError = nil
4631
+ },
4632
+ SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) {
4633
+ m.Pool.
4634
+ On("AddTx", context.Background(), mock.IsType(ethTypes.Transaction{}), "").
4635
+ Return(nil).
4636
+ Once()
4637
+ m.Pool.
4638
+ On("CheckPolicy", context.Background(), pool.SendTx, allowedContract).
4639
+ Return(true, nil).
4640
+ Once()
4641
+ m.Pool.
4642
+ On("CheckPolicy", context.Background(), pool.SendTx, allowed.From).
4643
+ Return(true, nil).
4644
+ Once()
4645
+ },
4646
+ },
4647
+ {
4648
+ Name: "Contract not on allow list, rejected",
4649
+ Prepare: func(t *testing.T, tc *testCase) {
4650
+ tx := ethTypes.NewTransaction(1, disallowedContract, big.NewInt(1), uint64(1), big.NewInt(1), []byte{})
4651
+
4652
+ signedTx, err := allowed.Signer(allowed.From, tx)
4653
+ require.NoError(t, err)
4654
+
4655
+ txBinary, err := signedTx.MarshalBinary()
4656
+ require.NoError(t, err)
4657
+
4658
+ rawTx := hex.EncodeToHex(txBinary)
4659
+ require.NoError(t, err)
4660
+
4661
+ tc.Input = rawTx
4662
+ tc.ExpectedResult = nil
4663
+ tc.ExpectedError = contractDenied
4664
+ },
4665
+ SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) {
4666
+ m.Pool.
4667
+ On("CheckPolicy", context.Background(), pool.SendTx, disallowedContract).
4668
+ Return(false, contractDenied).
4669
+ Once()
4670
+ },
4671
+ },
4672
+ {
4673
+ Name: "Sender not on allow list, rejected",
4674
+ Prepare: func(t *testing.T, tc *testCase) {
4675
+ tx := ethTypes.NewTransaction(1, allowedContract, big.NewInt(1), uint64(1), big.NewInt(1), []byte{})
4676
+
4677
+ signedTx, err := disallowed.Signer(disallowed.From, tx)
4678
+ require.NoError(t, err)
4679
+
4680
+ txBinary, err := signedTx.MarshalBinary()
4681
+ require.NoError(t, err)
4682
+
4683
+ rawTx := hex.EncodeToHex(txBinary)
4684
+ require.NoError(t, err)
4685
+
4686
+ tc.Input = rawTx
4687
+ tc.ExpectedResult = nil
4688
+ tc.ExpectedError = senderDenied
4689
+ },
4690
+ SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) {
4691
+ m.Pool.
4692
+ On("CheckPolicy", context.Background(), pool.SendTx, allowedContract).
4693
+ Return(true, nil).
4694
+ Once()
4695
+ m.Pool.
4696
+ On("CheckPolicy", context.Background(), pool.SendTx, disallowed.From).
4697
+ Return(false, senderDenied).
4698
+ Once()
4699
+ },
4700
+ },
4701
+ {
4702
+ Name: "Unsigned tx with allowed contract, accepted", // for backward compatibility
4703
+ Prepare: func(t *testing.T, tc *testCase) {
4704
+ tx := ethTypes.NewTransaction(1, allowedContract, big.NewInt(1), uint64(1), big.NewInt(1), []byte{})
4705
+
4706
+ txBinary, err := tx.MarshalBinary()
4707
+ require.NoError(t, err)
4708
+
4709
+ rawTx := hex.EncodeToHex(txBinary)
4710
+ require.NoError(t, err)
4711
+
4712
+ tc.Input = rawTx
4713
+ expectedHash := tx.Hash()
4714
+ tc.ExpectedResult = &expectedHash
4715
+ tc.ExpectedError = nil
4716
+ },
4717
+ SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) {
4718
+ m.Pool.
4719
+ On("AddTx", context.Background(), mock.IsType(ethTypes.Transaction{}), "").
4720
+ Return(nil).
4721
+ Once()
4722
+ // policy does not reject this case for backward compat
4723
+ },
4724
+ },
4725
+ {
4726
+ Name: "Unsigned tx with disallowed contract, rejected",
4727
+ Prepare: func(t *testing.T, tc *testCase) {
4728
+ tx := ethTypes.NewTransaction(1, disallowedContract, big.NewInt(1), uint64(1), big.NewInt(1), []byte{})
4729
+
4730
+ signedTx, err := disallowed.Signer(disallowed.From, tx)
4731
+ require.NoError(t, err)
4732
+
4733
+ txBinary, err := signedTx.MarshalBinary()
4734
+ require.NoError(t, err)
4735
+
4736
+ rawTx := hex.EncodeToHex(txBinary)
4737
+ require.NoError(t, err)
4738
+
4739
+ tc.Input = rawTx
4740
+ tc.ExpectedResult = nil
4741
+ tc.ExpectedError = contractDenied
4742
+ },
4743
+ SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) {
4744
+ m.Pool.
4745
+ On("CheckPolicy", context.Background(), pool.SendTx, disallowedContract).
4746
+ Return(false, contractDenied).
4747
+ Once()
4748
+ },
4749
+ },
4750
+ {
4751
+ Name: "Send invalid tx input", // for backward compatibility
4752
+ Prepare: func(t *testing.T, tc *testCase) {
4753
+ tc.Input = "0x1234"
4754
+ tc.ExpectedResult = nil
4755
+ tc.ExpectedError = types.NewRPCError(types.InvalidParamsErrorCode, "invalid tx input")
4756
+ },
4757
+ SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) {},
4758
+ },
4759
+ {
4760
+ Name: "Sender not on deploy allow list, rejected",
4761
+ Prepare: func(t *testing.T, tc *testCase) {
4762
+ deployAddr := common.HexToAddress("0x0")
4763
+ tx := ethTypes.NewTransaction(1, deployAddr, big.NewInt(1), uint64(1), big.NewInt(1), []byte{})
4764
+
4765
+ signedTx, err := disallowed.Signer(disallowed.From, tx)
4766
+ require.NoError(t, err)
4767
+
4768
+ txBinary, err := signedTx.MarshalBinary()
4769
+ require.NoError(t, err)
4770
+
4771
+ rawTx := hex.EncodeToHex(txBinary)
4772
+ require.NoError(t, err)
4773
+
4774
+ tc.Input = rawTx
4775
+ tc.ExpectedResult = nil
4776
+ tc.ExpectedError = deployDenied
4777
+ },
4778
+ SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) {
4779
+ m.Pool.
4780
+ On("CheckPolicy", context.Background(), pool.Deploy, disallowed.From).
4781
+ Return(false, nil).
4782
+ Once()
4783
+ },
4784
+ },
4785
+ }
4786
+
4787
+ for _, testCase := range testCases {
4788
+ t.Run(testCase.Name, func(t *testing.T) {
4789
+ tc := testCase
4790
+ tc.Prepare(t, &tc)
4791
+ tc.SetupMocks(t, m, tc)
4792
+
4793
+ res, err := s.JSONRPCCall("eth_sendRawTransaction", tc.Input)
4794
+ require.NoError(t, err)
4795
+
4796
+ assert.Equal(t, float64(1), res.ID)
4797
+ assert.Equal(t, "2.0", res.JSONRPC)
4798
+
4799
+ if res.Result != nil || tc.ExpectedResult != nil {
4800
+ var result common.Hash
4801
+ err = json.Unmarshal(res.Result, &result)
4802
+ require.NoError(t, err)
4803
+ assert.Equal(t, *tc.ExpectedResult, result)
4804
+ }
4805
+ if res.Error != nil || tc.ExpectedError != nil {
4806
+ assert.Equal(t, tc.ExpectedError.ErrorCode(), res.Error.Code)
4807
+ assert.Equal(t, tc.ExpectedError.Error(), res.Error.Message)
4808
+ }
4809
+ })
4810
+ }
4811
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/endpoints_zkevm.go RENAMED
@@ -195,6 +195,52 @@
195
  return rpcBatch, nil
196
  }
197
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  // GetFullBlockByNumber returns information about a block by block number
199
  func (z *ZKEVMEndpoints) GetFullBlockByNumber(number types.BlockNumber, fullTx bool) (interface{}, types.Error) {
200
  ctx := context.Background()
 
195
  return rpcBatch, nil
196
  }
197
 
198
+ type batchDataFunc func(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error)
199
+
200
+ // GetBatchDataByNumbers returns L2 batch data by batch numbers.
201
+ func (z *ZKEVMEndpoints) GetBatchDataByNumbers(filter types.BatchFilter) (interface{}, types.Error) {
202
+ return z.getBatchData(filter, z.state.GetBatchL2DataByNumbers)
203
+ }
204
+
205
+ // GetForcedBatchDataByNumbers returns forced batch data by batch numbers.
206
+ func (z *ZKEVMEndpoints) GetForcedBatchDataByNumbers(filter types.BatchFilter) (interface{}, types.Error) {
207
+ return z.getBatchData(filter, z.state.GetForcedBatchDataByNumbers)
208
+ }
209
+
210
+ func (z *ZKEVMEndpoints) getBatchData(filter types.BatchFilter, f batchDataFunc) (interface{}, types.Error) {
211
+ ctx := context.Background()
212
+ batchNumbers := make([]uint64, 0, len(filter.Numbers))
213
+ for _, bn := range filter.Numbers {
214
+ n, rpcErr := bn.GetNumericBatchNumber(ctx, z.state, z.etherman, nil)
215
+ if rpcErr != nil {
216
+ return nil, rpcErr
217
+ }
218
+ batchNumbers = append(batchNumbers, n)
219
+ }
220
+
221
+ batchesData, err := f(ctx, batchNumbers, nil)
222
+ if errors.Is(err, state.ErrNotFound) {
223
+ return nil, nil
224
+ } else if err != nil {
225
+ return RPCErrorResponse(types.DefaultErrorCode,
226
+ fmt.Sprintf("couldn't load batch data from state by numbers %v", filter.Numbers), err, true)
227
+ }
228
+
229
+ ret := make([]*types.BatchData, 0, len(batchNumbers))
230
+ for _, n := range batchNumbers {
231
+ data := &types.BatchData{Number: types.ArgUint64(n)}
232
+ if b, ok := batchesData[n]; ok {
233
+ data.BatchL2Data = b
234
+ data.Empty = false
235
+ } else {
236
+ data.Empty = true
237
+ }
238
+ ret = append(ret, data)
239
+ }
240
+
241
+ return types.BatchDataResult{Data: ret}, nil
242
+ }
243
+
244
  // GetFullBlockByNumber returns information about a block by block number
245
  func (z *ZKEVMEndpoints) GetFullBlockByNumber(number types.BlockNumber, fullTx bool) (interface{}, types.Error) {
246
  ctx := context.Background()
{/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/endpoints_zkevm_test.go RENAMED
@@ -2180,3 +2180,27 @@
2180
  })
2181
  }
2182
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2180
  })
2181
  }
2182
  }
2183
+
2184
+ func TestClient_BatchesByNumbers(t *testing.T) {
2185
+ const batchesCount = 6
2186
+
2187
+ s, m, _ := newSequencerMockedServer(t)
2188
+ defer s.Stop()
2189
+
2190
+ batchesDataMap := make(map[uint64][]byte, batchesCount)
2191
+ for i := 0; i < batchesCount; i++ {
2192
+ batchesDataMap[uint64(i+1)] = []byte(fmt.Sprintf("batch %d data", i+1))
2193
+ }
2194
+
2195
+ m.State.On("GetBatchL2DataByNumbers", mock.Anything, mock.Anything, mock.Anything).
2196
+ Return(batchesDataMap, nil).Once()
2197
+
2198
+ zkEVMClient := client.NewClient(s.ServerURL)
2199
+ reqBatchesNum := []*big.Int{big.NewInt(1), big.NewInt(3), big.NewInt(4)}
2200
+ result, err := zkEVMClient.BatchesByNumbers(context.Background(), reqBatchesNum)
2201
+ require.NoError(t, err)
2202
+ require.Len(t, result, len(reqBatchesNum))
2203
+ for i, batchNum := range reqBatchesNum {
2204
+ require.Equal(t, hex.EncodeToHex(batchesDataMap[batchNum.Uint64()]), result[i].BatchL2Data.Hex())
2205
+ }
2206
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/policy.go RENAMED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package jsonrpc
2
+
3
+ import (
4
+ "context"
5
+
6
+ "github.com/0xPolygonHermez/zkevm-node/jsonrpc/types"
7
+ "github.com/0xPolygonHermez/zkevm-node/pool"
8
+ "github.com/0xPolygonHermez/zkevm-node/state"
9
+ "github.com/ethereum/go-ethereum/common"
10
+ ethTypes "github.com/ethereum/go-ethereum/core/types"
11
+ )
12
+
13
+ func checkPolicy(ctx context.Context, p types.PoolInterface, input string) error {
14
+ tx, err := hexToTx(input)
15
+ if err != nil {
16
+ // ignore it, let the later processing reject
17
+ return nil
18
+ }
19
+
20
+ // if the tx is signed, check the from address. If there is no from address, the tx is not rejected as it
21
+ // will get rejected later. This maintains backward compatibility with RPC expectations. TODO: verify this is ok behavior
22
+ var from common.Address
23
+ if from, err = state.GetSender(*tx); err != nil {
24
+ // if not signed, then skip check, it fails later on its own
25
+ return nil
26
+ }
27
+
28
+ switch resolvePolicy(tx) {
29
+ case pool.SendTx:
30
+ var allow bool
31
+ if allow, err = p.CheckPolicy(ctx, pool.SendTx, *tx.To()); err != nil {
32
+ return err
33
+ }
34
+ if !allow {
35
+ return pool.ErrContractDisallowedSendTx
36
+ }
37
+ if allow, err = p.CheckPolicy(ctx, pool.SendTx, from); err != nil {
38
+ return err
39
+ }
40
+ if !allow {
41
+ return pool.ErrSenderDisallowedSendTx
42
+ }
43
+ case pool.Deploy:
44
+ var allow bool
45
+ // check that sender may deploy contracts
46
+ if allow, err = p.CheckPolicy(ctx, pool.Deploy, from); err != nil {
47
+ return err
48
+ }
49
+ if !allow {
50
+ return pool.ErrSenderDisallowedDeploy
51
+ }
52
+ }
53
+ return nil
54
+ }
55
+
56
+ func resolvePolicy(tx *ethTypes.Transaction) pool.PolicyName {
57
+ if tx.To() == nil || tx.To().Hex() == common.HexToAddress("0x0").Hex() {
58
+ return pool.Deploy
59
+ }
60
+ return pool.SendTx
61
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/types/errors.go RENAMED
@@ -15,6 +15,8 @@
15
  InvalidParamsErrorCode = -32602
16
  // ParserErrorCode error code for parsing errors
17
  ParserErrorCode = -32700
 
 
18
  )
19
 
20
  var (
 
15
  InvalidParamsErrorCode = -32602
16
  // ParserErrorCode error code for parsing errors
17
  ParserErrorCode = -32700
18
+ // AccessDeniedCode error code when requests are denied
19
+ AccessDeniedCode = -32800
20
  )
21
 
22
  var (
{/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/types/interfaces.go RENAMED
@@ -23,6 +23,7 @@
23
  CountPendingTransactions(ctx context.Context) (uint64, error)
24
  GetTransactionByHash(ctx context.Context, hash common.Hash) (*pool.Transaction, error)
25
  GetTransactionByL2Hash(ctx context.Context, hash common.Hash) (*pool.Transaction, error)
 
26
  CalculateEffectiveGasPrice(rawTx []byte, txGasPrice *big.Int, txGasUsed uint64, l1GasPrice uint64, l2GasPrice uint64) (*big.Int, error)
27
  EffectiveGasPriceEnabled() bool
28
  }
@@ -63,6 +64,8 @@
63
  GetLastVerifiedBatch(ctx context.Context, dbTx pgx.Tx) (*state.VerifiedBatch, error)
64
  GetLastBatchNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error)
65
  GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error)
 
 
66
  GetTransactionsByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (txs []types.Transaction, effectivePercentages []uint8, err error)
67
  GetVirtualBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.VirtualBatch, error)
68
  GetVerifiedBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.VerifiedBatch, error)
 
23
  CountPendingTransactions(ctx context.Context) (uint64, error)
24
  GetTransactionByHash(ctx context.Context, hash common.Hash) (*pool.Transaction, error)
25
  GetTransactionByL2Hash(ctx context.Context, hash common.Hash) (*pool.Transaction, error)
26
+ CheckPolicy(ctx context.Context, policy pool.PolicyName, address common.Address) (bool, error)
27
  CalculateEffectiveGasPrice(rawTx []byte, txGasPrice *big.Int, txGasUsed uint64, l1GasPrice uint64, l2GasPrice uint64) (*big.Int, error)
28
  EffectiveGasPriceEnabled() bool
29
  }
 
64
  GetLastVerifiedBatch(ctx context.Context, dbTx pgx.Tx) (*state.VerifiedBatch, error)
65
  GetLastBatchNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error)
66
  GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error)
67
+ GetBatchL2DataByNumbers(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error)
68
+ GetForcedBatchDataByNumbers(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error)
69
  GetTransactionsByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (txs []types.Transaction, effectivePercentages []uint8, err error)
70
  GetVirtualBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.VirtualBatch, error)
71
  GetVerifiedBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.VerifiedBatch, error)
{/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/types/types.go RENAMED
@@ -446,6 +446,23 @@
446
  return res, nil
447
  }
448
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
449
  // TransactionOrHash for union type of transaction and types.Hash
450
  type TransactionOrHash struct {
451
  Hash *common.Hash
 
446
  return res, nil
447
  }
448
 
449
+ // BatchFilter is a list of batch numbers to retrieve
450
+ type BatchFilter struct {
451
+ Numbers []BatchNumber `json:"numbers"`
452
+ }
453
+
454
+ // BatchData is an abbreviated structure that only contains the number and L2 batch data
455
+ type BatchData struct {
456
+ Number ArgUint64 `json:"number"`
457
+ BatchL2Data ArgBytes `json:"batchL2Data,omitempty"`
458
+ Empty bool `json:"empty"`
459
+ }
460
+
461
+ // BatchDataResult is a list of BatchData for a BatchFilter
462
+ type BatchDataResult struct {
463
+ Data []*BatchData `json:"data"`
464
+ }
465
+
466
  // TransactionOrHash for union type of transaction and types.Hash
467
  type TransactionOrHash struct {
468
  Hash *common.Hash
{/home/stefan/go/src/Polygon/zkevm-node → .}/pool/errors.go RENAMED
@@ -76,4 +76,13 @@
76
 
77
  // ErrZeroL1GasPrice is returned if the L1 gas price is 0.
78
  ErrZeroL1GasPrice = errors.New("L1 gas price 0")
 
 
 
 
 
 
 
 
 
79
  )
 
76
 
77
  // ErrZeroL1GasPrice is returned if the L1 gas price is 0.
78
  ErrZeroL1GasPrice = errors.New("L1 gas price 0")
79
+
80
+ // ErrSenderDisallowedSendTx is returned when transactions by sender are is disallowed by policy
81
+ ErrSenderDisallowedSendTx = errors.New("sender disallowed send_tx by policy")
82
+
83
+ // ErrContractDisallowedSendTx is returned when transactions to contract are is disallowed by policy
84
+ ErrContractDisallowedSendTx = errors.New("contract disallowed send_tx by policy")
85
+
86
+ // ErrSenderDisallowedDeploy is returned when deploy transactions are disallowed by policy
87
+ ErrSenderDisallowedDeploy = errors.New("sender disallowed deploy by policy")
88
  )
{/home/stefan/go/src/Polygon/zkevm-node → .}/pool/interfaces.go RENAMED
@@ -38,6 +38,7 @@
38
  MarkWIPTxsAsPending(ctx context.Context) error
39
  GetAllAddressesBlocked(ctx context.Context) ([]common.Address, error)
40
  MinL2GasPriceSince(ctx context.Context, timestamp time.Time) (uint64, error)
 
41
  GetEarliestProcessedTx(ctx context.Context) (common.Hash, error)
42
  }
43
 
@@ -48,3 +49,12 @@
48
  GetTransactionByHash(ctx context.Context, transactionHash common.Hash, dbTx pgx.Tx) (*types.Transaction, error)
49
  PreProcessTransaction(ctx context.Context, tx *types.Transaction, dbTx pgx.Tx) (*state.ProcessBatchResponse, error)
50
  }
 
 
 
 
 
 
 
 
 
 
38
  MarkWIPTxsAsPending(ctx context.Context) error
39
  GetAllAddressesBlocked(ctx context.Context) ([]common.Address, error)
40
  MinL2GasPriceSince(ctx context.Context, timestamp time.Time) (uint64, error)
41
+ policy
42
  GetEarliestProcessedTx(ctx context.Context) (common.Hash, error)
43
  }
44
 
 
49
  GetTransactionByHash(ctx context.Context, transactionHash common.Hash, dbTx pgx.Tx) (*types.Transaction, error)
50
  PreProcessTransaction(ctx context.Context, tx *types.Transaction, dbTx pgx.Tx) (*state.ProcessBatchResponse, error)
51
  }
52
+ type policy interface {
53
+ CheckPolicy(ctx context.Context, policy PolicyName, address common.Address) (bool, error)
54
+ AddAddressesToPolicy(ctx context.Context, policy PolicyName, addresses []common.Address) error
55
+ RemoveAddressesFromPolicy(ctx context.Context, policy PolicyName, addresses []common.Address) error
56
+ ClearPolicy(ctx context.Context, policy PolicyName) error
57
+ DescribePolicies(ctx context.Context) ([]Policy, error)
58
+ DescribePolicy(ctx context.Context, name PolicyName) (Policy, error)
59
+ ListAcl(ctx context.Context, policy PolicyName, query []common.Address) ([]common.Address, error)
60
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/pool/pgpoolstorage/policy.go RENAMED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package pgpoolstorage
2
+
3
+ import (
4
+ "context"
5
+ "errors"
6
+ "fmt"
7
+ "strings"
8
+
9
+ "github.com/0xPolygonHermez/zkevm-node/pool"
10
+ "github.com/ethereum/go-ethereum/common"
11
+ "github.com/jackc/pgx/v4"
12
+ )
13
+
14
+ // CheckPolicy returns the rule for the named policy and address. If the address is associated with the policy, the rule
15
+ // will be the setting for the policy. If the address is no associated with the policy, the rule will be the opposite of
16
+ // the policy setting.
17
+ func (p *PostgresPoolStorage) CheckPolicy(ctx context.Context, policy pool.PolicyName, address common.Address) (bool, error) {
18
+ sql := `SELECT
19
+ CASE WHEN a.address is null THEN
20
+ NOT p.allow
21
+ ELSE
22
+ p.allow
23
+ END
24
+ FROM pool.policy p
25
+ LEFT JOIN pool.acl a
26
+ ON p.name = a.policy
27
+ AND a.address = $1
28
+ WHERE p.name = $2`
29
+
30
+ rows, err := p.db.Query(ctx, sql, address.Hex(), policy)
31
+
32
+ if errors.Is(err, pgx.ErrNoRows) {
33
+ return false, pool.ErrNotFound
34
+ } else if err != nil {
35
+ return false, err
36
+ }
37
+
38
+ defer rows.Close()
39
+ if !rows.Next() { // should always be a row if the policy exists
40
+ return false, nil
41
+ }
42
+
43
+ var allow bool
44
+ err = rows.Scan(&allow)
45
+ if err != nil {
46
+ return false, err
47
+ }
48
+ return allow, nil
49
+ }
50
+
51
+ // UpdatePolicy sets the allow/deny rule for the named policy
52
+ func (p *PostgresPoolStorage) UpdatePolicy(ctx context.Context, policy pool.PolicyName, allow bool) error {
53
+ sql := "UPDATE pool.policy SET allow = $1 WHERE name = $2"
54
+ _, err := p.db.Exec(ctx, sql, allow, string(policy))
55
+ if err != nil {
56
+ return err
57
+ }
58
+ return nil
59
+ }
60
+
61
+ // AddAddressesToPolicy adds addresses to the named policy
62
+ func (p *PostgresPoolStorage) AddAddressesToPolicy(ctx context.Context, policy pool.PolicyName, addresses []common.Address) error {
63
+ sql := "INSERT INTO pool.acl (policy, address) VALUES ($1, $2) ON CONFLICT DO NOTHING"
64
+ tx, err := p.db.Begin(ctx)
65
+ if err != nil {
66
+ return err
67
+ }
68
+ defer func(tx pgx.Tx, ctx context.Context) {
69
+ _ = tx.Rollback(ctx)
70
+ }(tx, ctx)
71
+
72
+ for _, a := range addresses {
73
+ _, err = tx.Exec(ctx, sql, policy, a.Hex())
74
+ if err != nil {
75
+ return err
76
+ }
77
+ }
78
+ err = tx.Commit(ctx)
79
+ if err != nil {
80
+ return nil
81
+ }
82
+ return nil
83
+ }
84
+
85
+ // RemoveAddressesFromPolicy removes addresses from the named policy
86
+ func (p *PostgresPoolStorage) RemoveAddressesFromPolicy(ctx context.Context, policy pool.PolicyName, addresses []common.Address) error {
87
+ sql := "DELETE FROM pool.acl WHERE policy = $1 AND address = $2"
88
+ tx, err := p.db.Begin(ctx)
89
+ if err != nil {
90
+ return err
91
+ }
92
+ defer func(tx pgx.Tx, ctx context.Context) {
93
+ _ = tx.Rollback(ctx)
94
+ }(tx, ctx)
95
+
96
+ for _, a := range addresses {
97
+ _, err = tx.Exec(ctx, sql, policy, a.Hex())
98
+ if err != nil {
99
+ return err
100
+ }
101
+ }
102
+ err = tx.Commit(ctx)
103
+ if err != nil {
104
+ return err
105
+ }
106
+ return nil
107
+ }
108
+
109
+ // ClearPolicy removes _all_ addresses from the named policy
110
+ func (p *PostgresPoolStorage) ClearPolicy(ctx context.Context, policy pool.PolicyName) error {
111
+ sql := "DELETE FROM pool.acl WHERE policy = $1"
112
+ _, err := p.db.Exec(ctx, sql, policy)
113
+ if err != nil {
114
+ return err
115
+ }
116
+ return nil
117
+ }
118
+
119
+ // DescribePolicies return all the policies
120
+ func (p *PostgresPoolStorage) DescribePolicies(ctx context.Context) ([]pool.Policy, error) {
121
+ sql := "SELECT name, allow FROM pool.policy"
122
+ rows, err := p.db.Query(ctx, sql)
123
+ if err != nil {
124
+ if errors.Is(err, pgx.ErrNoRows) {
125
+ return nil, nil
126
+ } else {
127
+ return nil, err
128
+ }
129
+ }
130
+ defer rows.Close()
131
+
132
+ var list []pool.Policy
133
+ for rows.Next() {
134
+ var name string
135
+ var allow bool
136
+ err = rows.Scan(&name, &allow)
137
+ if err != nil {
138
+ return nil, err
139
+ }
140
+ if pool.IsPolicy(name) { // skip unknown
141
+ p := pool.Policy{
142
+ Name: pool.PolicyName(name),
143
+ Allow: allow,
144
+ }
145
+ list = append(list, p)
146
+ }
147
+ }
148
+ return list, nil
149
+ }
150
+
151
+ // DescribePolicy returns the named policy
152
+ func (p *PostgresPoolStorage) DescribePolicy(ctx context.Context, name pool.PolicyName) (pool.Policy, error) {
153
+ sql := "SELECT name, allow FROM pool.policy WHERE name = $1 LIMIT 1"
154
+ row := p.db.QueryRow(ctx, sql, name)
155
+ var (
156
+ pName string
157
+ allow bool
158
+ )
159
+ err := row.Scan(&pName, &allow)
160
+ if err != nil {
161
+ return pool.Policy{}, err
162
+ }
163
+ return pool.Policy{
164
+ Name: pool.PolicyName(pName),
165
+ Allow: allow,
166
+ }, nil
167
+ }
168
+
169
+ // ListAcl returns a list of the addresses associated with the policy
170
+ func (p *PostgresPoolStorage) ListAcl(
171
+ ctx context.Context, policy pool.PolicyName, query []common.Address) ([]common.Address, error) {
172
+ sql := "SELECT address FROM pool.acl WHERE policy = $1"
173
+
174
+ if len(query) > 0 {
175
+ var addrs []string
176
+ for _, a := range query {
177
+ addrs = append(addrs, a.Hex())
178
+ }
179
+ sql = sql + fmt.Sprintf(" IN (%v)", strings.Join(addrs, ","))
180
+ }
181
+
182
+ rows, err := p.db.Query(ctx, sql, string(policy))
183
+ if err != nil {
184
+ if errors.Is(err, pgx.ErrNoRows) {
185
+ return nil, nil
186
+ } else {
187
+ return nil, err
188
+ }
189
+ }
190
+ defer rows.Close()
191
+
192
+ var addresses []common.Address
193
+ for rows.Next() {
194
+ var addr string
195
+ err = rows.Scan(&addr)
196
+ if err != nil {
197
+ return nil, err
198
+ }
199
+ addresses = append(addresses, common.HexToAddress(addr))
200
+ }
201
+ return addresses, nil
202
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/pool/policy.go RENAMED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package pool
2
+
3
+ import "github.com/ethereum/go-ethereum/common"
4
+
5
+ // PolicyName is a named policy
6
+ type PolicyName string
7
+
8
+ const (
9
+ // SendTx is the name of the policy that governs that an address may send transactions to pool
10
+ SendTx PolicyName = "send_tx"
11
+ // Deploy is the name of the policy that governs that an address may deploy a contract
12
+ Deploy PolicyName = "deploy"
13
+ )
14
+
15
+ // Policy describes state of a named policy
16
+ type Policy struct {
17
+ Name PolicyName
18
+ Allow bool
19
+ }
20
+
21
+ // Desc returns the string representation of a policy rule
22
+ func (p *Policy) Desc() string {
23
+ if p.Allow {
24
+ return "allow"
25
+ }
26
+ return "deny"
27
+ }
28
+
29
+ // Acl describes exception to a named Policy by address
30
+ type Acl struct {
31
+ PolicyName PolicyName
32
+ Address common.Address
33
+ }
34
+
35
+ // IsPolicy tests if a string represents a known named Policy
36
+ func IsPolicy(name string) bool {
37
+ for _, p := range []PolicyName{SendTx, Deploy} {
38
+ if name == string(p) {
39
+ return true
40
+ }
41
+ }
42
+ return false
43
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/pool/pool.go RENAMED
@@ -95,6 +95,13 @@
95
  time.Sleep(cfg.IntervalToRefreshGasPrices.Duration)
96
  }
97
  }(&cfg, p)
 
 
 
 
 
 
 
98
 
99
  return p
100
  }
@@ -735,6 +742,11 @@
735
  return gas, nil
736
  }
737
 
 
 
 
 
 
738
  // checkTxFee is an internal function used to check whether the fee of
739
  // the given transaction is _reasonable_(under the cap).
740
  func checkTxFee(gasPrice *big.Int, gas uint64, cap float64) error {
 
95
  time.Sleep(cfg.IntervalToRefreshGasPrices.Duration)
96
  }
97
  }(&cfg, p)
98
+ p.refreshBlockedAddresses()
99
+ go func(cfg *Config, p *Pool) {
100
+ for {
101
+ time.Sleep(cfg.IntervalToRefreshBlockedAddresses.Duration)
102
+ p.refreshBlockedAddresses()
103
+ }
104
+ }(&cfg, p)
105
 
106
  return p
107
  }
 
742
  return gas, nil
743
  }
744
 
745
+ // CheckPolicy checks if an address is allowed by policy name
746
+ func (p *Pool) CheckPolicy(ctx context.Context, policy PolicyName, address common.Address) (bool, error) {
747
+ return p.storage.CheckPolicy(ctx, policy, address)
748
+ }
749
+
750
  // checkTxFee is an internal function used to check whether the fee of
751
  // the given transaction is _reasonable_(under the cap).
752
  func checkTxFee(gasPrice *big.Int, gas uint64, cap float64) error {
{/home/stefan/go/src/Polygon/zkevm-node → .}/pool/pool_test.go RENAMED
@@ -2144,3 +2144,69 @@
2144
  require.NoError(t, err)
2145
  return signedTx
2146
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2144
  require.NoError(t, err)
2145
  return signedTx
2146
  }
2147
+
2148
+ func Test_PolicyAcl(t *testing.T) {
2149
+ initOrResetDB(t)
2150
+
2151
+ poolSqlDB, err := db.NewSQLDB(poolDBCfg)
2152
+ require.NoError(t, err)
2153
+ defer poolSqlDB.Close() //nolint:gosec,errcheck
2154
+
2155
+ ctx := context.Background()
2156
+ s, err := pgpoolstorage.NewPostgresPoolStorage(poolDBCfg)
2157
+ require.NoError(t, err)
2158
+
2159
+ p := pool.NewPool(cfg, bc, s, nil, uint64(1), nil)
2160
+
2161
+ randAddr := func() common.Address {
2162
+ buf := make([]byte, 20)
2163
+ _, err = rand.Read(buf)
2164
+ require.NoError(t, err)
2165
+ return common.BytesToAddress(buf)
2166
+ }
2167
+
2168
+ // Policies start out as deny lists, since there are no addresses on the
2169
+ // lists, random addresses will always be allowed
2170
+ for _, policy := range []pool.PolicyName{pool.SendTx, pool.Deploy} {
2171
+ allow, err := p.CheckPolicy(ctx, policy, randAddr())
2172
+ require.NoError(t, err)
2173
+ require.True(t, allow)
2174
+ }
2175
+
2176
+ addr := randAddr()
2177
+
2178
+ // put addr on lists
2179
+ for _, policy := range []pool.PolicyName{pool.SendTx, pool.Deploy} {
2180
+ ctag, err := poolSqlDB.Exec(ctx, "INSERT INTO pool.acl (policy, address) VALUES ($1,$2)", policy, addr.Hex())
2181
+ require.NoError(t, err)
2182
+ require.Equal(t, int64(1), ctag.RowsAffected())
2183
+ }
2184
+
2185
+ // addr should not be denied by policy
2186
+ for _, policy := range []pool.PolicyName{pool.SendTx, pool.Deploy} {
2187
+ allow, err := p.CheckPolicy(ctx, policy, addr)
2188
+ require.NoError(t, err)
2189
+ require.False(t, allow)
2190
+ }
2191
+
2192
+ // change policies to allow by acl
2193
+ ctag, err := poolSqlDB.Exec(ctx, "UPDATE pool.policy SET allow = true")
2194
+ require.NoError(t, err)
2195
+ require.Equal(t, int64(2), ctag.RowsAffected())
2196
+
2197
+ // addr is now allowed
2198
+ for _, policy := range []pool.PolicyName{pool.SendTx, pool.Deploy} {
2199
+ allow, err := p.CheckPolicy(ctx, policy, addr)
2200
+ require.NoError(t, err)
2201
+ require.True(t, allow)
2202
+ }
2203
+
2204
+ // random addrs are now denied
2205
+ for _, policy := range []pool.PolicyName{pool.SendTx, pool.Deploy} {
2206
+ for _, a := range []common.Address{randAddr(), randAddr()} {
2207
+ allow, err := s.CheckPolicy(ctx, policy, a)
2208
+ require.NoError(t, err)
2209
+ require.False(t, allow)
2210
+ }
2211
+ }
2212
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/proto/src/proto/executor/v1/executor.proto RENAMED
@@ -292,6 +292,7 @@
292
  // prior to executing the call.
293
  map<string, OverrideAccountV2> state_override = 23;
294
  DebugV2 debug = 24;
 
295
  }
296
 
297
  message L1DataV2 {
 
292
  // prior to executing the call.
293
  map<string, OverrideAccountV2> state_override = 23;
294
  DebugV2 debug = 24;
295
+ uint64 execution_mode = 25;
296
  }
297
 
298
  message L1DataV2 {
{/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/finalizer.go RENAMED
@@ -490,6 +490,7 @@
490
  SkipWriteBlockInfoRoot_V2: true,
491
  SkipVerifyL1InfoRoot_V2: true,
492
  L1InfoTreeData_V2: map[uint32]state.L1DataV2{},
 
493
  }
494
 
495
  txGasPrice := tx.GasPrice
 
490
  SkipWriteBlockInfoRoot_V2: true,
491
  SkipVerifyL1InfoRoot_V2: true,
492
  L1InfoTreeData_V2: map[uint32]state.L1DataV2{},
493
+ ExecutionMode: executor.ExecutionMode0,
494
  }
495
 
496
  txGasPrice := tx.GasPrice
{/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/l2block.go RENAMED
@@ -336,6 +337,7 @@
336
  ForkID: f.stateIntf.GetForkIDByBatchNumber(l2Block.batch.batchNumber),
337
  SkipVerifyL1InfoRoot_V2: true,
338
  L1InfoTreeData_V2: map[uint32]state.L1DataV2{},
 
339
  }
340
  batchRequest.L1InfoTreeData_V2[l2Block.l1InfoTreeExitRoot.L1InfoTreeIndex] = state.L1DataV2{
341
  GlobalExitRoot: l2Block.l1InfoTreeExitRoot.GlobalExitRoot.GlobalExitRoot,
@@ -696,6 +698,7 @@
696
  SkipFirstChangeL2Block_V2: false,
697
  Transactions: f.stateIntf.BuildChangeL2Block(f.wipL2Block.deltaTimestamp, f.wipL2Block.getL1InfoTreeIndex()),
698
  L1InfoTreeData_V2: map[uint32]state.L1DataV2{},
 
699
  }
700
 
701
  batchRequest.L1InfoTreeData_V2[f.wipL2Block.l1InfoTreeExitRoot.L1InfoTreeIndex] = state.L1DataV2{
 
337
  ForkID: f.stateIntf.GetForkIDByBatchNumber(l2Block.batch.batchNumber),
338
  SkipVerifyL1InfoRoot_V2: true,
339
  L1InfoTreeData_V2: map[uint32]state.L1DataV2{},
340
+ ExecutionMode: executor.ExecutionMode0,
341
  }
342
  batchRequest.L1InfoTreeData_V2[l2Block.l1InfoTreeExitRoot.L1InfoTreeIndex] = state.L1DataV2{
343
  GlobalExitRoot: l2Block.l1InfoTreeExitRoot.GlobalExitRoot.GlobalExitRoot,
 
698
  SkipFirstChangeL2Block_V2: false,
699
  Transactions: f.stateIntf.BuildChangeL2Block(f.wipL2Block.deltaTimestamp, f.wipL2Block.getL1InfoTreeIndex()),
700
  L1InfoTreeData_V2: map[uint32]state.L1DataV2{},
701
+ ExecutionMode: executor.ExecutionMode0,
702
  }
703
 
704
  batchRequest.L1InfoTreeData_V2[f.wipL2Block.l1InfoTreeExitRoot.L1InfoTreeIndex] = state.L1DataV2{
{/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/config.go RENAMED
@@ -41,6 +41,8 @@
41
  // gas offset: 100
42
  // final gas: 1100
43
  GasOffset uint64 `mapstructure:"GasOffset"`
 
 
44
  // SequenceL1BlockConfirmations is number of blocks to consider a sequence sent to L1 as final
45
  SequenceL1BlockConfirmations uint64 `mapstructure:"SequenceL1BlockConfirmations"`
46
  }
 
41
  // gas offset: 100
42
  // final gas: 1100
43
  GasOffset uint64 `mapstructure:"GasOffset"`
44
+ // MaxBatchesForL1 is the maximum amount of batches to be sequenced in a single L1 tx
45
+ MaxBatchesForL1 uint64 `mapstructure:"MaxBatchesForL1"`
46
  // SequenceL1BlockConfirmations is number of blocks to consider a sequence sent to L1 as final
47
  SequenceL1BlockConfirmations uint64 `mapstructure:"SequenceL1BlockConfirmations"`
48
  }
{/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/interfaces.go RENAMED
@@ -17,8 +17,8 @@
17
 
18
  // etherman contains the methods required to interact with ethereum.
19
  type etherman interface {
20
- BuildSequenceBatchesTxData(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, initSequenceBatchNumber uint64, l2Coinbase common.Address) (to *common.Address, data []byte, err error)
21
- EstimateGasSequenceBatches(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, initSequenceBatchNumber uint64, l2Coinbase common.Address) (*types.Transaction, error)
22
  GetLatestBlockHeader(ctx context.Context) (*types.Header, error)
23
  GetLatestBatchNumber() (uint64, error)
24
  }
@@ -41,3 +41,7 @@
41
  Add(ctx context.Context, owner, id string, from common.Address, to *common.Address, value *big.Int, data []byte, gasOffset uint64, dbTx pgx.Tx) error
42
  ProcessPendingMonitoredTxs(ctx context.Context, owner string, failedResultHandler ethtxmanager.ResultHandler, dbTx pgx.Tx)
43
  }
 
 
 
 
 
17
 
18
  // etherman contains the methods required to interact with ethereum.
19
  type etherman interface {
20
+ BuildSequenceBatchesTxData(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, initSequenceBatchNumber uint64, l2Coinbase common.Address, committeeSignaturesAndAddrs []byte) (to *common.Address, data []byte, err error)
21
+ EstimateGasSequenceBatches(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, initSequenceBatchNumber uint64, l2Coinbase common.Address, committeeSignaturesAndAddrs []byte) (*types.Transaction, error)
22
  GetLatestBlockHeader(ctx context.Context) (*types.Header, error)
23
  GetLatestBatchNumber() (uint64, error)
24
  }
 
41
  Add(ctx context.Context, owner, id string, from common.Address, to *common.Address, value *big.Int, data []byte, gasOffset uint64, dbTx pgx.Tx) error
42
  ProcessPendingMonitoredTxs(ctx context.Context, owner string, failedResultHandler ethtxmanager.ResultHandler, dbTx pgx.Tx)
43
  }
44
+
45
+ type dataAbilitier interface {
46
+ PostSequence(ctx context.Context, sequences []ethmanTypes.Sequence) ([]byte, error)
47
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/sequencesender.go RENAMED
@@ -6,14 +6,12 @@
6
  "fmt"
7
  "time"
8
 
9
- ethman "github.com/0xPolygonHermez/zkevm-node/etherman"
10
  "github.com/0xPolygonHermez/zkevm-node/etherman/types"
11
  "github.com/0xPolygonHermez/zkevm-node/ethtxmanager"
12
  "github.com/0xPolygonHermez/zkevm-node/event"
13
  "github.com/0xPolygonHermez/zkevm-node/log"
14
  "github.com/0xPolygonHermez/zkevm-node/state"
15
  "github.com/ethereum/go-ethereum/common"
16
- ethTypes "github.com/ethereum/go-ethereum/core/types"
17
  "github.com/jackc/pgx/v4"
18
  )
19
 
@@ -39,6 +37,7 @@
39
  // SequenceSender represents a sequence sender
40
  type SequenceSender struct {
41
  cfg Config
 
42
  state stateInterface
43
  ethTxManager ethTxManager
44
  etherman etherman
@@ -48,13 +47,14 @@
48
  }
49
 
50
  // New inits sequence sender
51
- func New(cfg Config, state stateInterface, etherman etherman, manager ethTxManager, eventLog *event.EventLog) (*SequenceSender, error) {
52
  return &SequenceSender{
53
  cfg: cfg,
54
  state: state,
55
  etherman: etherman,
56
  ethTxManager: manager,
57
  eventLog: eventLog,
 
58
  }, nil
59
  }
60
 
@@ -239,9 +239,14 @@
239
  }
240
 
241
  // add sequence to be monitored
242
- firstSequence := sequences[0]
 
 
 
 
243
 
244
- to, data, err := s.etherman.BuildSequenceBatchesTxData(s.cfg.SenderAddress, sequences, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber-1, s.cfg.L2Coinbase)
 
245
  if err != nil {
246
  log.Error("error estimating new sequenceBatches to add to eth tx manager: ", err)
247
  return
@@ -275,8 +280,6 @@
275
  sequences := []types.Sequence{}
276
  // var estimatedGas uint64
277
 
278
- var tx *ethTypes.Transaction
279
-
280
  // Add sequences until too big for a single L1 tx or last batch is reached
281
  for {
282
  //Check if the next batch belongs to a new forkid, in this case we need to stop sequencing as we need to
@@ -345,31 +348,11 @@
345
 
346
  sequences = append(sequences, seq)
347
  // Check if can be send
348
- firstSequence := sequences[0]
349
- lastSequence := sequences[len(sequences)-1]
350
- tx, err = s.etherman.EstimateGasSequenceBatches(s.cfg.SenderAddress, sequences, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber-1, s.cfg.L2Coinbase)
351
- if err == nil && tx.Size() > s.cfg.MaxTxSizeForL1 {
352
- log.Infof("oversized Data on TX oldHash %s (txSize %d > %d)", tx.Hash(), tx.Size(), s.cfg.MaxTxSizeForL1)
353
- err = ErrOversizedData
354
- }
355
- if err != nil {
356
- log.Infof("Handling estimage gas send sequence error: %v", err)
357
- sequences, err = s.handleEstimateGasSendSequenceErr(sequences, currentBatchNumToSequence, err)
358
- if sequences != nil {
359
- if len(sequences) > 0 {
360
- // Handling the error gracefully, re-processing the sequence as a sanity check
361
- lastSequence = sequences[len(sequences)-1]
362
- _, err = s.etherman.EstimateGasSequenceBatches(s.cfg.SenderAddress, sequences, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber-1, s.cfg.L2Coinbase)
363
- return sequences, err
364
- }
365
- }
366
- return sequences, err
367
- }
368
- // estimatedGas = tx.Gas()
369
-
370
- //Check if the current batch is the last before a change to a new forkid, in this case we need to close and send the sequence to L1
371
- if (s.cfg.ForkUpgradeBatchNumber != 0) && (currentBatchNumToSequence == (s.cfg.ForkUpgradeBatchNumber)) {
372
- log.Infof("sequence should be sent to L1, as we have reached the batch %d from which a new forkid is applied (upgrade)", s.cfg.ForkUpgradeBatchNumber)
373
  return sequences, nil
374
  }
375
 
@@ -400,73 +383,6 @@
400
  return nil, nil
401
  }
402
 
403
- // handleEstimateGasSendSequenceErr handles an error on the estimate gas. It will return:
404
- // nil, error: impossible to handle gracefully
405
- // sequence, nil: handled gracefully. Potentially manipulating the sequences
406
- // nil, nil: a situation that requires waiting
407
- func (s *SequenceSender) handleEstimateGasSendSequenceErr(sequences []types.Sequence, currentBatchNumToSequence uint64, err error) ([]types.Sequence, error) {
408
- // Insufficient allowance
409
- if errors.Is(err, ethman.ErrInsufficientAllowance) {
410
- return nil, err
411
- }
412
- if isDataForEthTxTooBig(err) {
413
- // Remove the latest item and send the sequences
414
- log.Infof(
415
- "Done building sequences, selected batches to %d. Batch %d caused the L1 tx to be too big",
416
- currentBatchNumToSequence-1, currentBatchNumToSequence,
417
- )
418
- sequences = sequences[:len(sequences)-1]
419
- return sequences, nil
420
- }
421
-
422
- // while estimating gas a new block is not created and the POE SC may return
423
- // an error regarding timestamp verification, this must be handled
424
- // if errors.Is(err, ethman.ErrTimestampMustBeInsideRange) {
425
- // // query the sc about the value of its lastTimestamp variable
426
- // lastTimestamp, err := s.etherman.GetLastBatchTimestamp()
427
- // if err != nil {
428
- // return nil, err
429
- // }
430
- // // check POE SC lastTimestamp against sequences' one
431
- // for _, seq := range sequences {
432
- // if seq.Timestamp < int64(lastTimestamp) {
433
- // // TODO: gracefully handle this situation by creating an L2 reorg
434
- // log.Fatalf("sequence timestamp %d is < POE SC lastTimestamp %d", seq.Timestamp, lastTimestamp)
435
- // }
436
- // lastTimestamp = uint64(seq.Timestamp)
437
- // }
438
- // blockTimestamp, err := s.etherman.GetLatestBlockTimestamp(ctx)
439
- // if err != nil {
440
- // log.Error("error getting block timestamp: ", err)
441
- // }
442
- // log.Debugf("block.timestamp: %d is smaller than seq.Timestamp: %d. A new block must be mined in L1 before the gas can be estimated.", blockTimestamp, sequences[0].Timestamp)
443
- // return nil, nil
444
- // }
445
-
446
- // Unknown error
447
- if len(sequences) == 1 {
448
- // TODO: gracefully handle this situation by creating an L2 reorg
449
- log.Errorf(
450
- "Error when estimating gas for BatchNum %d (alone in the sequences): %v",
451
- currentBatchNumToSequence, err,
452
- )
453
- }
454
- // Remove the latest item and send the sequences
455
- log.Infof(
456
- "Done building sequences, selected batches to %d. Batch %d excluded due to unknown error: %v",
457
- currentBatchNumToSequence, currentBatchNumToSequence+1, err,
458
- )
459
- sequences = sequences[:len(sequences)-1]
460
-
461
- return sequences, nil
462
- }
463
-
464
- func isDataForEthTxTooBig(err error) bool {
465
- return errors.Is(err, ethman.ErrGasRequiredExceedsAllowance) ||
466
- errors.Is(err, ErrOversizedData) ||
467
- errors.Is(err, ethman.ErrContentLengthTooLarge)
468
- }
469
-
470
  func (s *SequenceSender) sanityCheck(ctx context.Context, retries int, waitRetry time.Duration) (bool, error) {
471
  lastVirtualBatchNum, err := s.state.GetLastVirtualBatchNum(ctx, nil)
472
  if err != nil && err != state.ErrNotFound {
 
6
  "fmt"
7
  "time"
8
 
 
9
  "github.com/0xPolygonHermez/zkevm-node/etherman/types"
10
  "github.com/0xPolygonHermez/zkevm-node/ethtxmanager"
11
  "github.com/0xPolygonHermez/zkevm-node/event"
12
  "github.com/0xPolygonHermez/zkevm-node/log"
13
  "github.com/0xPolygonHermez/zkevm-node/state"
14
  "github.com/ethereum/go-ethereum/common"
 
15
  "github.com/jackc/pgx/v4"
16
  )
17
 
 
37
  // SequenceSender represents a sequence sender
38
  type SequenceSender struct {
39
  cfg Config
40
+ da dataAbilitier
41
  state stateInterface
42
  ethTxManager ethTxManager
43
  etherman etherman
 
47
  }
48
 
49
  // New inits sequence sender
50
+ func New(cfg Config, state stateInterface, etherman etherman, manager ethTxManager, eventLog *event.EventLog, da dataAbilitier) (*SequenceSender, error) {
51
  return &SequenceSender{
52
  cfg: cfg,
53
  state: state,
54
  etherman: etherman,
55
  ethTxManager: manager,
56
  eventLog: eventLog,
57
+ da: da,
58
  }, nil
59
  }
60
 
 
239
  }
240
 
241
  // add sequence to be monitored
242
+ dataAvailabilityMessage, err := s.da.PostSequence(ctx, sequences)
243
+ if err != nil {
244
+ log.Error("error posting sequences to the data availability protocol: ", err)
245
+ return
246
+ }
247
 
248
+ firstSequence := sequences[0]
249
+ to, data, err := s.etherman.BuildSequenceBatchesTxData(s.cfg.SenderAddress, sequences, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber-1, s.cfg.L2Coinbase, dataAvailabilityMessage)
250
  if err != nil {
251
  log.Error("error estimating new sequenceBatches to add to eth tx manager: ", err)
252
  return
 
280
  sequences := []types.Sequence{}
281
  // var estimatedGas uint64
282
 
 
 
283
  // Add sequences until too big for a single L1 tx or last batch is reached
284
  for {
285
  //Check if the next batch belongs to a new forkid, in this case we need to stop sequencing as we need to
 
348
 
349
  sequences = append(sequences, seq)
350
  // Check if can be send
351
+ if len(sequences) == int(s.cfg.MaxBatchesForL1) {
352
+ log.Info(
353
+ "sequence should be sent to L1, because MaxBatchesForL1 (%d) has been reached",
354
+ s.cfg.MaxBatchesForL1,
355
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
356
  return sequences, nil
357
  }
358
 
 
383
  return nil, nil
384
  }
385
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
386
  func (s *SequenceSender) sanityCheck(ctx context.Context, retries int, waitRetry time.Duration) (bool, error) {
387
  lastVirtualBatchNum, err := s.state.GetLastVirtualBatchNum(ctx, nil)
388
  if err != nil && err != state.ErrNotFound {
{/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/sequencesender_test.go RENAMED
@@ -30,7 +30,7 @@
30
  stateMock := new(StateMock)
31
  ethermanMock := new(EthermanMock)
32
  ethTxManagerMock := new(EthTxManagerMock)
33
- ssender, err := New(Config{}, stateMock, ethermanMock, ethTxManagerMock, nil)
34
  assert.NoError(t, err)
35
 
36
  testCases := []IsSyncedTestCase{
 
30
  stateMock := new(StateMock)
31
  ethermanMock := new(EthermanMock)
32
  ethTxManagerMock := new(EthTxManagerMock)
33
+ ssender, err := New(Config{}, stateMock, ethermanMock, ethTxManagerMock, nil, nil)
34
  assert.NoError(t, err)
35
 
36
  testCases := []IsSyncedTestCase{
{/home/stefan/go/src/Polygon/zkevm-node → .}/state/batchV2.go RENAMED
@@ -69,6 +69,7 @@
69
  ChainId: s.cfg.ChainID,
70
  ForkId: request.ForkID,
71
  ContextId: uuid.NewString(),
 
72
  }
73
 
74
  if request.SkipFirstChangeL2Block_V2 {
@@ -131,6 +132,7 @@
131
  ForkId: forkId,
132
  ContextId: uuid.NewString(),
133
  SkipVerifyL1InfoRoot: skipVerifyL1InfoRoot,
 
134
  }
135
 
136
  if forcedBlockHashL1 != nil {
@@ -231,6 +233,7 @@
231
  ContextId: uuid.NewString(),
232
  SkipVerifyL1InfoRoot: processingCtx.SkipVerifyL1InfoRoot,
233
  L1InfoRoot: processingCtx.L1InfoRoot.Bytes(),
 
234
  }
235
 
236
  if processingCtx.ForcedBlockHashL1 != nil {
 
69
  ChainId: s.cfg.ChainID,
70
  ForkId: request.ForkID,
71
  ContextId: uuid.NewString(),
72
+ ExecutionMode: request.ExecutionMode,
73
  }
74
 
75
  if request.SkipFirstChangeL2Block_V2 {
 
132
  ForkId: forkId,
133
  ContextId: uuid.NewString(),
134
  SkipVerifyL1InfoRoot: skipVerifyL1InfoRoot,
135
+ ExecutionMode: executor.ExecutionMode1,
136
  }
137
 
138
  if forcedBlockHashL1 != nil {
 
233
  ContextId: uuid.NewString(),
234
  SkipVerifyL1InfoRoot: processingCtx.SkipVerifyL1InfoRoot,
235
  L1InfoRoot: processingCtx.L1InfoRoot.Bytes(),
236
+ ExecutionMode: processingCtx.ExecutionMode,
237
  }
238
 
239
  if processingCtx.ForcedBlockHashL1 != nil {
{/home/stefan/go/src/Polygon/zkevm-node → .}/state/genesis.go RENAMED
@@ -19,8 +19,10 @@
19
 
20
  // Genesis contains the information to populate state on creation
21
  type Genesis struct {
22
- // BlockNumber is the block number where the polygonZKEVM smc was deployed on L1
23
- BlockNumber uint64
 
 
24
  // Root hash of the genesis block
25
  Root common.Hash
26
  // Actions is the data to populate into the state trie
 
19
 
20
  // Genesis contains the information to populate state on creation
21
  type Genesis struct {
22
+ // RollupBlockNumber is the block number where the polygonZKEVM smc was deployed on L1
23
+ RollupBlockNumber uint64
24
+ // RollupManagerBlockNumber is the block number where the RollupManager smc was deployed on L1
25
+ RollupManagerBlockNumber uint64
26
  // Root hash of the genesis block
27
  Root common.Hash
28
  // Actions is the data to populate into the state trie
{/home/stefan/go/src/Polygon/zkevm-node → .}/state/interfaces.go RENAMED
@@ -153,6 +153,9 @@
153
  GetBlockByNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*Block, error)
154
  GetVirtualBatchParentHash(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (common.Hash, error)
155
  GetForcedBatchParentHash(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) (common.Hash, error)
 
 
 
156
  GetLatestBatchGlobalExitRoot(ctx context.Context, dbTx pgx.Tx) (common.Hash, error)
157
  GetL2TxHashByTxHash(ctx context.Context, hash common.Hash, dbTx pgx.Tx) (*common.Hash, error)
158
  GetSyncInfoData(ctx context.Context, dbTx pgx.Tx) (SyncInfoDataOnStorage, error)
 
153
  GetBlockByNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*Block, error)
154
  GetVirtualBatchParentHash(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (common.Hash, error)
155
  GetForcedBatchParentHash(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) (common.Hash, error)
156
+ GetBatchL2DataByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) ([]byte, error)
157
+ GetBatchL2DataByNumbers(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error)
158
+ GetForcedBatchDataByNumbers(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error)
159
  GetLatestBatchGlobalExitRoot(ctx context.Context, dbTx pgx.Tx) (common.Hash, error)
160
  GetL2TxHashByTxHash(ctx context.Context, hash common.Hash, dbTx pgx.Tx) (*common.Hash, error)
161
  GetSyncInfoData(ctx context.Context, dbTx pgx.Tx) (SyncInfoDataOnStorage, error)
{/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/pgstatestorage.go RENAMED
@@ -355,3 +355,87 @@
355
  }
356
  return nativeBlockHashes, nil
357
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
355
  }
356
  return nativeBlockHashes, nil
357
  }
358
+
359
+ // GetBatchL2DataByNumber returns the batch L2 data of the given batch number.
360
+ func (p *PostgresStorage) GetBatchL2DataByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) ([]byte, error) {
361
+ batchData, err := p.GetBatchL2DataByNumbers(ctx, []uint64{batchNumber}, dbTx)
362
+ if err != nil {
363
+ return nil, err
364
+ }
365
+ data, ok := batchData[batchNumber]
366
+ if !ok {
367
+ return nil, state.ErrNotFound
368
+ }
369
+ return data, nil
370
+ }
371
+
372
+ // GetBatchL2DataByNumbers returns the batch L2 data of the given batch numbers. The data is a union of state.batch and state.forced_batch tables.
373
+ func (p *PostgresStorage) GetBatchL2DataByNumbers(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error) {
374
+ const sql = "SELECT batch_num, raw_txs_data FROM state.batch WHERE batch_num = ANY($1)"
375
+ return p.getBatchData(ctx, sql, batchNumbers, dbTx)
376
+ }
377
+
378
+ // GetForcedBatchDataByNumbers returns the forced batch data of the given batch numbers
379
+ func (p *PostgresStorage) GetForcedBatchDataByNumbers(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error) {
380
+ const sql = "SELECT forced_batch_num, convert_from(decode(raw_txs_data, 'hex'), 'UTF8')::bytea FROM state.forced_batch WHERE forced_batch_num = ANY($1)"
381
+ return p.getBatchData(ctx, sql, batchNumbers, dbTx)
382
+ }
383
+
384
+ func (p *PostgresStorage) getBatchData(ctx context.Context, sql string, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error) {
385
+ q := p.getExecQuerier(dbTx)
386
+ rows, err := q.Query(ctx, sql, batchNumbers)
387
+ if errors.Is(err, pgx.ErrNoRows) {
388
+ return p.GetBatchL2DataByNumbersFromBackup(ctx, batchNumbers, dbTx)
389
+ } else if err != nil {
390
+ return nil, err
391
+ }
392
+ defer rows.Close()
393
+
394
+ batchL2DataMap, err := readBatchDataResults(rows, batchNumbers)
395
+ if err != nil {
396
+ return nil, err
397
+ }
398
+
399
+ if len(batchL2DataMap) == 0 {
400
+ return p.GetBatchL2DataByNumbersFromBackup(ctx, batchNumbers, dbTx)
401
+ }
402
+
403
+ return batchL2DataMap, nil
404
+ }
405
+
406
+ // GetBatchL2DataByNumbersFromBackup returns the batch L2 data of the given batch number from the backup table
407
+ func (p *PostgresStorage) GetBatchL2DataByNumbersFromBackup(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error) {
408
+ getBatchL2DataByBatchNumber := `
409
+ SELECT batch_num, data FROM state.batch_data_backup
410
+ WHERE batch_num = ANY($1)
411
+ ORDER BY created_at DESC
412
+ `
413
+ q := p.getExecQuerier(dbTx)
414
+ rows, err := q.Query(ctx, getBatchL2DataByBatchNumber, batchNumbers)
415
+ if errors.Is(err, pgx.ErrNoRows) {
416
+ return nil, state.ErrNotFound
417
+ } else if err != nil {
418
+ return nil, err
419
+ }
420
+ defer rows.Close()
421
+
422
+ return readBatchDataResults(rows, batchNumbers)
423
+ }
424
+
425
+ // readBatchDataResults retrieves batch data from the provided result set
426
+ func readBatchDataResults(results pgx.Rows, batchNumbers []uint64) (map[uint64][]byte, error) {
427
+ batchL2DataMap := make(map[uint64][]byte, len(batchNumbers))
428
+ for results.Next() {
429
+ var (
430
+ batchNum uint64
431
+ batchL2Data []byte
432
+ )
433
+
434
+ if err := results.Scan(&batchNum, &batchL2Data); err != nil {
435
+ return nil, err
436
+ }
437
+ batchL2DataMap[batchNum] = batchL2Data
438
+ }
439
+
440
+ return batchL2DataMap, nil
441
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/pgstatestorage_test.go RENAMED
@@ -1371,6 +1371,108 @@
1371
  require.NoError(t, dbTx.Commit(ctx))
1372
  }
1373
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1374
  func createL1InfoTreeExitRootStorageEntryForTest(blockNumber uint64, index uint32) *state.L1InfoTreeExitRootStorageEntry {
1375
  exitRoot := state.L1InfoTreeExitRootStorageEntry{
1376
  L1InfoTreeLeaf: state.L1InfoTreeLeaf{
@@ -1572,6 +1674,13 @@
1572
  require.Equal(t, uint64(2002), fb.BlockNumber)
1573
  require.Equal(t, "0x717e05de47a87a7d1679e183f1c224150675f6302b7da4eaab526b2b91ae0761", fb.GlobalExitRoot.String())
1574
  require.Equal(t, []byte{0xb}, fb.RawTxsData)
 
 
 
 
 
 
 
1575
  }
1576
 
1577
  func TestGetLastGER(t *testing.T) {
@@ -1648,7 +1757,6 @@
1648
  ger, err = testState.GetLatestBatchGlobalExitRoot(ctx, dbTx)
1649
  require.NoError(t, err)
1650
  require.Equal(t, common.HexToHash("0x2").String(), ger.String())
1651
-
1652
  }
1653
 
1654
  func TestGetFirstUncheckedBlock(t *testing.T) {
 
1371
  require.NoError(t, dbTx.Commit(ctx))
1372
  }
1373
 
1374
+ func TestGetBatchL2DataByNumber(t *testing.T) {
1375
+ // Init database instance
1376
+ initOrResetDB()
1377
+ ctx := context.Background()
1378
+ tx, err := testState.BeginStateTransaction(ctx)
1379
+ require.NoError(t, err)
1380
+ defer func() { require.NoError(t, tx.Commit(ctx)) }()
1381
+
1382
+ // empty case
1383
+ var batchNum uint64 = 4
1384
+ const (
1385
+ openBatchSQL = "INSERT INTO state.batch (batch_num, raw_txs_data, wip) VALUES ($1, $2, false)"
1386
+ resetBatchesSQL = "DELETE FROM state.batch"
1387
+ )
1388
+ _, err = tx.Exec(ctx, openBatchSQL, batchNum, nil)
1389
+ require.NoError(t, err)
1390
+ data, err := testState.GetBatchL2DataByNumber(ctx, batchNum, tx)
1391
+ require.NoError(t, err)
1392
+ assert.Nil(t, data)
1393
+
1394
+ // not empty case
1395
+ expectedData := []byte("foo bar")
1396
+ batchNum = 5
1397
+ _, err = tx.Exec(ctx, openBatchSQL, batchNum, expectedData)
1398
+ require.NoError(t, err)
1399
+ actualData, err := testState.GetBatchL2DataByNumber(ctx, batchNum, tx)
1400
+ require.NoError(t, err)
1401
+ assert.Equal(t, expectedData, actualData)
1402
+
1403
+ multiGet := []uint64{uint64(4), uint64(5), uint64(6)}
1404
+ allData, err := testState.GetBatchL2DataByNumbers(ctx, multiGet, tx)
1405
+ require.NoError(t, err)
1406
+ require.Equal(t, expectedData, allData[uint64(5)])
1407
+
1408
+ // Force backup
1409
+ _, err = tx.Exec(ctx, resetBatchesSQL)
1410
+ require.NoError(t, err)
1411
+
1412
+ // Get batch 4 from backup
1413
+ batchNum = 4
1414
+ data, err = testState.GetBatchL2DataByNumber(ctx, batchNum, tx)
1415
+ require.NoError(t, err)
1416
+ assert.Nil(t, data)
1417
+
1418
+ // Get batch 5 from backup
1419
+ batchNum = 5
1420
+ actualData, err = testState.GetBatchL2DataByNumber(ctx, batchNum, tx)
1421
+ require.NoError(t, err)
1422
+ assert.Equal(t, expectedData, actualData)
1423
+
1424
+ // Update batch 5 and get it from backup
1425
+ expectedData = []byte("new foo bar")
1426
+ _, err = tx.Exec(ctx, openBatchSQL, batchNum, expectedData)
1427
+ require.NoError(t, err)
1428
+ _, err = tx.Exec(ctx, resetBatchesSQL)
1429
+ require.NoError(t, err)
1430
+ actualData, err = testState.GetBatchL2DataByNumber(ctx, batchNum, tx)
1431
+ require.NoError(t, err)
1432
+ assert.Equal(t, expectedData, actualData)
1433
+ }
1434
+
1435
+ func TestGetBatchL2DataByNumbers(t *testing.T) {
1436
+ initOrResetDB()
1437
+ ctx := context.Background()
1438
+ tx, err := testState.BeginStateTransaction(ctx)
1439
+ require.NoError(t, err)
1440
+ defer func() { require.NoError(t, tx.Commit(ctx)) }()
1441
+
1442
+ var i1, i2, i3, i4, i5 = uint64(1), uint64(2), uint64(3), uint64(4), uint64(5)
1443
+ var d1, d2, d4 = []byte("foobar"), []byte("dingbat"), []byte{0xb}
1444
+
1445
+ const insertBatch = "INSERT INTO state.batch (batch_num, raw_txs_data) VALUES ($1, $2)"
1446
+ _, err = tx.Exec(ctx, insertBatch, i1, d1)
1447
+ require.NoError(t, err)
1448
+ _, err = tx.Exec(ctx, insertBatch, i2, d2)
1449
+ require.NoError(t, err)
1450
+ _, err = tx.Exec(ctx, insertBatch, i3, nil)
1451
+ require.NoError(t, err)
1452
+
1453
+ // Add a forced batch too, needs a block
1454
+ block1 := *block
1455
+ block1.BlockNumber = 1000
1456
+ err = testState.AddBlock(ctx, &block1, tx)
1457
+ require.NoError(t, err)
1458
+ err = tx.Commit(ctx)
1459
+ require.NoError(t, err)
1460
+
1461
+ tx, err = testState.BeginStateTransaction(ctx)
1462
+ require.NoError(t, err)
1463
+
1464
+ const insertForcedBatch = "INSERT INTO state.forced_batch (forced_batch_num, timestamp, raw_txs_data, block_num) VALUES (4, now(),'0b', 1000)"
1465
+ _, err = testState.Exec(ctx, insertForcedBatch)
1466
+ require.NoError(t, err)
1467
+
1468
+ allData, err := testState.GetForcedBatchDataByNumbers(ctx, []uint64{i4}, tx)
1469
+ require.NoError(t, err)
1470
+ assert.Equal(t, d4, allData[i4])
1471
+
1472
+ _, ok := allData[i5]
1473
+ assert.False(t, ok)
1474
+ }
1475
+
1476
  func createL1InfoTreeExitRootStorageEntryForTest(blockNumber uint64, index uint32) *state.L1InfoTreeExitRootStorageEntry {
1477
  exitRoot := state.L1InfoTreeExitRootStorageEntry{
1478
  L1InfoTreeLeaf: state.L1InfoTreeLeaf{
 
1674
  require.Equal(t, uint64(2002), fb.BlockNumber)
1675
  require.Equal(t, "0x717e05de47a87a7d1679e183f1c224150675f6302b7da4eaab526b2b91ae0761", fb.GlobalExitRoot.String())
1676
  require.Equal(t, []byte{0xb}, fb.RawTxsData)
1677
+
1678
+ // also check data retrieval
1679
+ fbData, err := testState.GetForcedBatchDataByNumbers(ctx, []uint64{1}, dbTx)
1680
+ require.NoError(t, err)
1681
+ var expected = make(map[uint64][]byte)
1682
+ expected[uint64(1)] = []byte{0xb}
1683
+ require.Equal(t, expected, fbData)
1684
  }
1685
 
1686
  func TestGetLastGER(t *testing.T) {
 
1757
  ger, err = testState.GetLatestBatchGlobalExitRoot(ctx, dbTx)
1758
  require.NoError(t, err)
1759
  require.Equal(t, common.HexToHash("0x2").String(), ger.String())
 
1760
  }
1761
 
1762
  func TestGetFirstUncheckedBlock(t *testing.T) {
{/home/stefan/go/src/Polygon/zkevm-node → .}/state/runtime/executor/client.go RENAMED
@@ -10,6 +10,13 @@
10
  "google.golang.org/grpc/credentials/insecure"
11
  )
12
 
 
 
 
 
 
 
 
13
  // NewExecutorClient is the executor client constructor.
14
  func NewExecutorClient(ctx context.Context, c Config) (ExecutorServiceClient, *grpc.ClientConn, context.CancelFunc) {
15
  opts := []grpc.DialOption{
 
10
  "google.golang.org/grpc/credentials/insecure"
11
  )
12
 
13
+ const (
14
+ // ExecutionMode0 is the execution mode for the sequencer and RPC, default one
15
+ ExecutionMode0 = uint64(0)
16
+ // ExecutionMode1 is the execution mode for the synchronizer
17
+ ExecutionMode1 = uint64(1)
18
+ )
19
+
20
  // NewExecutorClient is the executor client constructor.
21
  func NewExecutorClient(ctx context.Context, c Config) (ExecutorServiceClient, *grpc.ClientConn, context.CancelFunc) {
22
  opts := []grpc.DialOption{
{/home/stefan/go/src/Polygon/zkevm-node → .}/state/transaction.go RENAMED
@@ -546,6 +546,7 @@
546
  TimestampLimit: l2Block.Time(),
547
  SkipFirstChangeL2Block: cFalse,
548
  SkipWriteBlockInfoRoot: cTrue,
 
549
  }
550
  if noZKEVMCounters {
551
  processBatchRequestV2.NoCounters = cTrue
@@ -1055,6 +1056,7 @@
1055
  TimestampLimit: uint64(time.Now().Unix()),
1056
  SkipFirstChangeL2Block: cTrue,
1057
  SkipWriteBlockInfoRoot: cTrue,
 
1058
  }
1059
 
1060
  log.Debugf("EstimateGas[processBatchRequestV2.From]: %v", processBatchRequestV2.From)
 
546
  TimestampLimit: l2Block.Time(),
547
  SkipFirstChangeL2Block: cFalse,
548
  SkipWriteBlockInfoRoot: cTrue,
549
+ ExecutionMode: executor.ExecutionMode0,
550
  }
551
  if noZKEVMCounters {
552
  processBatchRequestV2.NoCounters = cTrue
 
1056
  TimestampLimit: uint64(time.Now().Unix()),
1057
  SkipFirstChangeL2Block: cTrue,
1058
  SkipWriteBlockInfoRoot: cTrue,
1059
+ ExecutionMode: executor.ExecutionMode0,
1060
  }
1061
 
1062
  log.Debugf("EstimateGas[processBatchRequestV2.From]: %v", processBatchRequestV2.From)
{/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/elderberry/processor_l1_sequence_batches.go RENAMED
@@ -3,7 +3,6 @@
3
  import (
4
  "context"
5
  "errors"
6
- "fmt"
7
  "time"
8
 
9
  "github.com/0xPolygonHermez/zkevm-node/etherman"
@@ -60,58 +59,12 @@
60
 
61
  sbatch := l1Block.SequencedBatches[order.Pos][0]
62
 
 
63
  if sbatch.SequencedBatchElderberryData == nil {
64
- log.Errorf("No elderberry sequenced batch data for batch %d", sbatch.BatchNumber)
65
- return fmt.Errorf("no elderberry sequenced batch data for batch %d", sbatch.BatchNumber)
 
66
  }
67
- // We need to check that the sequence match
68
- err := g.sanityCheckExpectedSequence(sbatch.SequencedBatchElderberryData.InitSequencedBatchNumber, dbTx)
69
- if err != nil {
70
- return err
71
- }
72
- // We known that the MaxSequenceTimestamp is the same for all the batches so we can use the first one
73
- err = g.previousProcessor.ProcessSequenceBatches(ctx, l1Block.SequencedBatches[order.Pos], l1Block.BlockNumber, time.Unix(int64(sbatch.SequencedBatchElderberryData.MaxSequenceTimestamp), 0), dbTx)
74
- // The last L2block timestamp must match MaxSequenceTimestamp
75
- if err != nil {
76
- return err
77
- }
78
- // It checks the timestamp of the last L2 block, but it's just log an error instead of refusing the event
79
- _ = g.sanityCheckTstampLastL2Block(sbatch.SequencedBatchElderberryData.MaxSequenceTimestamp, dbTx)
80
- return nil
81
- }
82
-
83
- func (g *ProcessorL1SequenceBatchesElderberry) sanityCheckExpectedSequence(initialBatchNumber uint64, dbTx pgx.Tx) error {
84
- // We need to check that the sequence match
85
- lastVirtualBatchNum, err := g.state.GetLastVirtualBatchNum(context.Background(), dbTx)
86
- if err != nil {
87
- log.Errorf("Error getting last virtual batch number: %s", err)
88
- return err
89
- }
90
- if lastVirtualBatchNum != initialBatchNumber {
91
- log.Errorf("The last virtual batch number is not the expected one. Expected: %d (last on DB), got: %d (L1 event)", lastVirtualBatchNum+1, initialBatchNumber)
92
- return fmt.Errorf("the last virtual batch number is not the expected one. Expected: %d (last on DB), got: %d (L1 event) err:%w", lastVirtualBatchNum+1, initialBatchNumber, ErrInvalidInitialBatchNumber)
93
- }
94
- return nil
95
- }
96
 
97
- func (g *ProcessorL1SequenceBatchesElderberry) sanityCheckTstampLastL2Block(timeLimit uint64, dbTx pgx.Tx) error {
98
- lastVirtualBatchNum, err := g.state.GetLastVirtualBatchNum(context.Background(), dbTx)
99
- if err != nil {
100
- log.Errorf("Error getting last virtual batch number: %s", err)
101
- return err
102
- }
103
- lastL2Block, err := g.state.GetLastL2BlockByBatchNumber(context.Background(), lastVirtualBatchNum, dbTx)
104
- if err != nil {
105
- log.Errorf("Error getting last virtual batch number: %s", err)
106
- return err
107
- }
108
- if lastL2Block == nil {
109
- //TODO: find the previous batch until we find a L2 block to check the timestamp
110
- return nil
111
- }
112
- if uint64(lastL2Block.ReceivedAt.Unix()) > timeLimit {
113
- log.Errorf("The last L2 block timestamp can't be greater than timeLimit. Expected: %d (L1 event), got: %d (last L2Block)", timeLimit, lastL2Block.ReceivedAt.Unix())
114
- return fmt.Errorf("wrong timestamp of last L2 block timestamp with L1 event timestamp")
115
- }
116
- return nil
117
  }
 
3
  import (
4
  "context"
5
  "errors"
 
6
  "time"
7
 
8
  "github.com/0xPolygonHermez/zkevm-node/etherman"
 
59
 
60
  sbatch := l1Block.SequencedBatches[order.Pos][0]
61
 
62
+ executionTime := l1Block.ReceivedAt
63
  if sbatch.SequencedBatchElderberryData == nil {
64
+ log.Warnf("No elderberry sequenced batch data for batch %d", sbatch.BatchNumber)
65
+ } else {
66
+ executionTime = time.Unix(int64(sbatch.SequencedBatchElderberryData.MaxSequenceTimestamp), 0)
67
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
 
69
+ return g.previousProcessor.ProcessSequenceBatches(ctx, l1Block.SequencedBatches[order.Pos], l1Block.BlockNumber, executionTime, dbTx)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  }
{/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l1_parallel_sync/l1_worker_etherman_test.go RENAMED
@@ -31,7 +31,7 @@
31
  GlobalExitRootManagerAddr: common.HexToAddress("0x8A791620dd6260079BF849Dc5567aDC3F2FdC318"),
32
  }
33
 
34
- ethermanClient, err := etherman.NewClient(cfg, l1Config)
35
  require.NoError(t, err)
36
  worker := newWorker(ethermanClient)
37
  ch := make(chan responseRollupInfoByBlockRange)
 
31
  GlobalExitRootManagerAddr: common.HexToAddress("0x8A791620dd6260079BF849Dc5567aDC3F2FdC318"),
32
  }
33
 
34
+ ethermanClient, err := etherman.NewClient(cfg, l1Config, nil, nil)
35
  require.NoError(t, err)
36
  worker := newWorker(ethermanClient)
37
  ch := make(chan responseRollupInfoByBlockRange)
{/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/config.go RENAMED
@@ -1,5 +1,7 @@
1
  package l2_sync
2
 
 
 
3
  // Config configuration of L2 sync process
4
  type Config struct {
5
  // If enabled then the L2 sync process is permitted (only for permissionless)
@@ -13,4 +15,7 @@
13
 
14
  // CheckLastL2BlockHashOnCloseBatch if is true when a batch is closed is force to check the last L2Block hash
15
  CheckLastL2BlockHashOnCloseBatch bool `mapstructure:"CheckLastL2BlockHashOnCloseBatch"`
 
 
 
16
  }
 
1
  package l2_sync
2
 
3
+ import "github.com/0xPolygonHermez/zkevm-node/dataavailability"
4
+
5
  // Config configuration of L2 sync process
6
  type Config struct {
7
  // If enabled then the L2 sync process is permitted (only for permissionless)
 
15
 
16
  // CheckLastL2BlockHashOnCloseBatch if is true when a batch is closed is force to check the last L2Block hash
17
  CheckLastL2BlockHashOnCloseBatch bool `mapstructure:"CheckLastL2BlockHashOnCloseBatch"`
18
+
19
+ // DataSourcePriority defines the order in which L2 batch should be retrieved: local, trusted, external
20
+ DataSourcePriority []dataavailability.DataSourcePriority `mapstructure:"DataSourcePriority"`
21
  }
{/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/l2_sync_etrog/executor_trusted_batch_sync.go RENAMED
@@ -428,6 +429,7 @@
428
  Transactions: data.TrustedBatch.BatchL2Data,
429
  ForkID: b.state.GetForkIDByBatchNumber(uint64(data.TrustedBatch.Number)),
430
  SkipVerifyL1InfoRoot_V2: true,
 
431
  }
432
  return request
433
  }
 
429
  Transactions: data.TrustedBatch.BatchL2Data,
430
  ForkID: b.state.GetForkIDByBatchNumber(uint64(data.TrustedBatch.Number)),
431
  SkipVerifyL1InfoRoot_V2: true,
432
+ ExecutionMode: executor.ExecutionMode1,
433
  }
434
  return request
435
  }
{/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/l2_sync_incaberry/sync_trusted_state.go RENAMED
@@ -196,6 +196,7 @@
196
  OldAccInputHash: batches[1].AccInputHash,
197
  Coinbase: common.HexToAddress(trustedBatch.Coinbase.String()),
198
  Timestamp_V1: time.Unix(int64(trustedBatch.Timestamp), 0),
 
199
  }
200
  // check if batch needs to be synchronized
201
  if batches[0] != nil {
 
196
  OldAccInputHash: batches[1].AccInputHash,
197
  Coinbase: common.HexToAddress(trustedBatch.Coinbase.String()),
198
  Timestamp_V1: time.Unix(int64(trustedBatch.Timestamp), 0),
199
+ ExecutionMode: executor.ExecutionMode1,
200
  }
201
  // check if batch needs to be synchronized
202
  if batches[0] != nil {
{/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/synchronizer.go RENAMED
@@ -298,7 +298,7 @@
298
  if err != nil {
299
  if errors.Is(err, state.ErrStateNotSynchronized) {
300
  log.Info("State is empty, verifying genesis block")
301
- valid, err := s.etherMan.VerifyGenBlockNumber(s.ctx, s.genesis.BlockNumber)
302
  if err != nil {
303
  log.Error("error checking genesis block number. Error: ", err)
304
  return rollback(s.ctx, dbTx, err)
@@ -306,12 +306,42 @@
306
  log.Error("genesis Block number configured is not valid. It is required the block number where the PolygonZkEVM smc was deployed")
307
  return rollback(s.ctx, dbTx, fmt.Errorf("genesis Block number configured is not valid. It is required the block number where the PolygonZkEVM smc was deployed"))
308
  }
309
- log.Info("Setting genesis block")
310
- header, err := s.etherMan.HeaderByNumber(s.ctx, big.NewInt(0).SetUint64(s.genesis.BlockNumber))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  if err != nil {
312
- log.Errorf("error getting l1 block header for block %d. Error: %v", s.genesis.BlockNumber, err)
313
  return rollback(s.ctx, dbTx, err)
314
  }
 
315
  lastEthBlockSynced = &state.Block{
316
  BlockNumber: header.Number.Uint64(),
317
  BlockHash: header.Hash(),
@@ -972,7 +1002,7 @@
972
  log.Infof("[checkReorg function] reorgedBlockNumber: %d reorgedBlockHash already synced: %s", reorgedBlock.BlockNumber, reorgedBlock.BlockHash.String())
973
 
974
  // Compare hashes
975
- if (block.BlockHash != reorgedBlock.BlockHash || block.ParentHash != reorgedBlock.ParentHash) && reorgedBlock.BlockNumber > s.genesis.BlockNumber {
976
  log.Infof("checkReorg: Bad block %d hashOk %t parentHashOk %t", reorgedBlock.BlockNumber, block.BlockHash == reorgedBlock.BlockHash, block.ParentHash == reorgedBlock.ParentHash)
977
  log.Debug("[checkReorg function] => latestBlockNumber: ", reorgedBlock.BlockNumber)
978
  log.Debug("[checkReorg function] => latestBlockHash: ", reorgedBlock.BlockHash)
 
298
  if err != nil {
299
  if errors.Is(err, state.ErrStateNotSynchronized) {
300
  log.Info("State is empty, verifying genesis block")
301
+ valid, err := s.etherMan.VerifyGenBlockNumber(s.ctx, s.genesis.RollupBlockNumber)
302
  if err != nil {
303
  log.Error("error checking genesis block number. Error: ", err)
304
  return rollback(s.ctx, dbTx, err)
 
306
  log.Error("genesis Block number configured is not valid. It is required the block number where the PolygonZkEVM smc was deployed")
307
  return rollback(s.ctx, dbTx, fmt.Errorf("genesis Block number configured is not valid. It is required the block number where the PolygonZkEVM smc was deployed"))
308
  }
309
+
310
+ // Sync events from RollupManager that happen before rollup creation
311
+ log.Info("synchronizing events from RollupManager that happen before rollup creation")
312
+ for i := s.genesis.RollupManagerBlockNumber; true; i += s.cfg.SyncChunkSize {
313
+ toBlock := min(i+s.cfg.SyncChunkSize-1, s.genesis.RollupBlockNumber-1)
314
+ blocks, order, err := s.etherMan.GetRollupInfoByBlockRange(s.ctx, i, &toBlock)
315
+ if err != nil {
316
+ log.Error("error getting rollupInfoByBlockRange before rollup genesis: ", err)
317
+ rollbackErr := dbTx.Rollback(s.ctx)
318
+ if rollbackErr != nil {
319
+ log.Errorf("error rolling back state. RollbackErr: %v, err: %s", rollbackErr, err.Error())
320
+ return rollbackErr
321
+ }
322
+ return err
323
+ }
324
+ err = s.ProcessBlockRange(blocks, order)
325
+ if err != nil {
326
+ log.Error("error processing blocks before the genesis: ", err)
327
+ rollbackErr := dbTx.Rollback(s.ctx)
328
+ if rollbackErr != nil {
329
+ log.Errorf("error rolling back state. RollbackErr: %v, err: %s", rollbackErr, err.Error())
330
+ return rollbackErr
331
+ }
332
+ return err
333
+ }
334
+ if toBlock == s.genesis.RollupBlockNumber-1 {
335
+ break
336
+ }
337
+ }
338
+
339
+ header, err := s.etherMan.HeaderByNumber(s.ctx, big.NewInt(0).SetUint64(s.genesis.RollupBlockNumber))
340
  if err != nil {
341
+ log.Errorf("error getting l1 block header for block %d. Error: %v", s.genesis.RollupBlockNumber, err)
342
  return rollback(s.ctx, dbTx, err)
343
  }
344
+ log.Info("synchronizing rollup creation block")
345
  lastEthBlockSynced = &state.Block{
346
  BlockNumber: header.Number.Uint64(),
347
  BlockHash: header.Hash(),
 
1002
  log.Infof("[checkReorg function] reorgedBlockNumber: %d reorgedBlockHash already synced: %s", reorgedBlock.BlockNumber, reorgedBlock.BlockHash.String())
1003
 
1004
  // Compare hashes
1005
+ if (block.BlockHash != reorgedBlock.BlockHash || block.ParentHash != reorgedBlock.ParentHash) && reorgedBlock.BlockNumber > s.genesis.RollupBlockNumber {
1006
  log.Infof("checkReorg: Bad block %d hashOk %t parentHashOk %t", reorgedBlock.BlockNumber, block.BlockHash == reorgedBlock.BlockHash, block.ParentHash == reorgedBlock.ParentHash)
1007
  log.Debug("[checkReorg function] => latestBlockNumber: ", reorgedBlock.BlockNumber)
1008
  log.Debug("[checkReorg function] => latestBlockHash: ", reorgedBlock.BlockHash)
{/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/synchronizer_test.go RENAMED
@@ -123,7 +123,7 @@
123
  // but it used a feature that is not implemented in new one that is asking beyond the last block on L1
124
  func TestForcedBatchEtrog(t *testing.T) {
125
  genesis := state.Genesis{
126
- BlockNumber: uint64(123456),
127
  }
128
  cfg := Config{
129
  SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
@@ -401,7 +401,7 @@
401
  // but it used a feature that is not implemented in new one that is asking beyond the last block on L1
402
  func TestSequenceForcedBatchIncaberry(t *testing.T) {
403
  genesis := state.Genesis{
404
- BlockNumber: uint64(123456),
405
  }
406
  cfg := Config{
407
  SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
@@ -663,7 +663,7 @@
663
 
664
  func setupGenericTest(t *testing.T) (*state.Genesis, *Config, *mocks) {
665
  genesis := state.Genesis{
666
- BlockNumber: uint64(123456),
667
  }
668
  cfg := Config{
669
  SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
@@ -930,7 +930,7 @@
930
 
931
  func TestReorg(t *testing.T) {
932
  genesis := state.Genesis{
933
- BlockNumber: uint64(0),
934
  }
935
  cfg := Config{
936
  SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
@@ -1253,7 +1253,7 @@
1253
 
1254
  func TestLatestSyncedBlockEmpty(t *testing.T) {
1255
  genesis := state.Genesis{
1256
- BlockNumber: uint64(0),
1257
  }
1258
  cfg := Config{
1259
  SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
@@ -1470,7 +1470,7 @@
1470
 
1471
  func TestRegularReorg(t *testing.T) {
1472
  genesis := state.Genesis{
1473
- BlockNumber: uint64(0),
1474
  }
1475
  cfg := Config{
1476
  SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
@@ -1755,7 +1755,7 @@
1755
 
1756
  func TestLatestSyncedBlockEmptyWithExtraReorg(t *testing.T) {
1757
  genesis := state.Genesis{
1758
- BlockNumber: uint64(0),
1759
  }
1760
  cfg := Config{
1761
  SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
@@ -2034,7 +2034,7 @@
2034
 
2035
  func TestCallFromEmptyBlockAndReorg(t *testing.T) {
2036
  genesis := state.Genesis{
2037
- BlockNumber: uint64(0),
2038
  }
2039
  cfg := Config{
2040
  SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
 
123
  // but it used a feature that is not implemented in new one that is asking beyond the last block on L1
124
  func TestForcedBatchEtrog(t *testing.T) {
125
  genesis := state.Genesis{
126
+ RollupBlockNumber: uint64(123456),
127
  }
128
  cfg := Config{
129
  SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
 
401
  // but it used a feature that is not implemented in new one that is asking beyond the last block on L1
402
  func TestSequenceForcedBatchIncaberry(t *testing.T) {
403
  genesis := state.Genesis{
404
+ RollupBlockNumber: uint64(123456),
405
  }
406
  cfg := Config{
407
  SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
 
663
 
664
  func setupGenericTest(t *testing.T) (*state.Genesis, *Config, *mocks) {
665
  genesis := state.Genesis{
666
+ RollupBlockNumber: uint64(123456),
667
  }
668
  cfg := Config{
669
  SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
 
930
 
931
  func TestReorg(t *testing.T) {
932
  genesis := state.Genesis{
933
+ RollupBlockNumber: uint64(0),
934
  }
935
  cfg := Config{
936
  SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
 
1253
 
1254
  func TestLatestSyncedBlockEmpty(t *testing.T) {
1255
  genesis := state.Genesis{
1256
+ RollupBlockNumber: uint64(0),
1257
  }
1258
  cfg := Config{
1259
  SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
 
1470
 
1471
  func TestRegularReorg(t *testing.T) {
1472
  genesis := state.Genesis{
1473
+ RollupBlockNumber: uint64(0),
1474
  }
1475
  cfg := Config{
1476
  SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
 
1755
 
1756
  func TestLatestSyncedBlockEmptyWithExtraReorg(t *testing.T) {
1757
  genesis := state.Genesis{
1758
+ RollupBlockNumber: uint64(0),
1759
  }
1760
  cfg := Config{
1761
  SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
 
2034
 
2035
  func TestCallFromEmptyBlockAndReorg(t *testing.T) {
2036
  genesis := state.Genesis{
2037
+ RollupBlockNumber: uint64(0),
2038
  }
2039
  cfg := Config{
2040
  SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/auto/customModExp.sol RENAMED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity >=0.7.0 <0.9.0;
3
+
4
+ contract customModExp {
5
+ bytes32 hashResult;
6
+ address retEcrecover;
7
+ bytes dataResult;
8
+ uint256 dataRes;
9
+
10
+ bytes32[10] arrayStorage;
11
+
12
+ function modExpGeneric(bytes memory input) public {
13
+ bytes32[10] memory output;
14
+
15
+ assembly {
16
+ let success := staticcall(gas(), 0x05, add(input, 32), mload(input), output, 0x140)
17
+ sstore(0x00, success)
18
+ }
19
+
20
+ for (uint i = 0; i < 10; i++) {
21
+ arrayStorage[i] = output[i];
22
+ }
23
+ }
24
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/bin/customModExp/customModExp.go RENAMED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Code generated - DO NOT EDIT.
2
+ // This file is a generated binding and any manual changes will be lost.
3
+
4
+ package customModExp
5
+
6
+ import (
7
+ "errors"
8
+ "math/big"
9
+ "strings"
10
+
11
+ ethereum "github.com/ethereum/go-ethereum"
12
+ "github.com/ethereum/go-ethereum/accounts/abi"
13
+ "github.com/ethereum/go-ethereum/accounts/abi/bind"
14
+ "github.com/ethereum/go-ethereum/common"
15
+ "github.com/ethereum/go-ethereum/core/types"
16
+ "github.com/ethereum/go-ethereum/event"
17
+ )
18
+
19
+ // Reference imports to suppress errors if they are not otherwise used.
20
+ var (
21
+ _ = errors.New
22
+ _ = big.NewInt
23
+ _ = strings.NewReader
24
+ _ = ethereum.NotFound
25
+ _ = bind.Bind
26
+ _ = common.Big1
27
+ _ = types.BloomLookup
28
+ _ = event.NewSubscription
29
+ _ = abi.ConvertType
30
+ )
31
+
32
+ // CustomModExpMetaData contains all meta data concerning the CustomModExp contract.
33
+ var CustomModExpMetaData = &bind.MetaData{
34
+ ABI: "[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"input\",\"type\":\"bytes\"}],\"name\":\"modExpGeneric\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]",
35
+ Bin: "0x608060405234801561001057600080fd5b50610208806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063d5665d6f14610030575b600080fd5b61004361003e3660046100e2565b610045565b005b61004d6100ad565b6101408183516020850160055afa60009081555b600a8110156100a8578181600a811061007c5761007c610193565b6020020151600482600a811061009457610094610193565b0155806100a0816101a9565b915050610061565b505050565b604051806101400160405280600a906020820280368337509192915050565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156100f457600080fd5b813567ffffffffffffffff8082111561010c57600080fd5b818401915084601f83011261012057600080fd5b813581811115610132576101326100cc565b604051601f8201601f19908116603f0116810190838211818310171561015a5761015a6100cc565b8160405282815287602084870101111561017357600080fd5b826020860160208301376000928101602001929092525095945050505050565b634e487b7160e01b600052603260045260246000fd5b60006000198214156101cb57634e487b7160e01b600052601160045260246000fd5b506001019056fea26469706673582212206c4940b4c9a7086754420734c8b4921cdb547ec8b31fc3bf8cd884ad9778a5b364736f6c634300080c0033",
36
+ }
37
+
38
+ // CustomModExpABI is the input ABI used to generate the binding from.
39
+ // Deprecated: Use CustomModExpMetaData.ABI instead.
40
+ var CustomModExpABI = CustomModExpMetaData.ABI
41
+
42
+ // CustomModExpBin is the compiled bytecode used for deploying new contracts.
43
+ // Deprecated: Use CustomModExpMetaData.Bin instead.
44
+ var CustomModExpBin = CustomModExpMetaData.Bin
45
+
46
+ // DeployCustomModExp deploys a new Ethereum contract, binding an instance of CustomModExp to it.
47
+ func DeployCustomModExp(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *CustomModExp, error) {
48
+ parsed, err := CustomModExpMetaData.GetAbi()
49
+ if err != nil {
50
+ return common.Address{}, nil, nil, err
51
+ }
52
+ if parsed == nil {
53
+ return common.Address{}, nil, nil, errors.New("GetABI returned nil")
54
+ }
55
+
56
+ address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(CustomModExpBin), backend)
57
+ if err != nil {
58
+ return common.Address{}, nil, nil, err
59
+ }
60
+ return address, tx, &CustomModExp{CustomModExpCaller: CustomModExpCaller{contract: contract}, CustomModExpTransactor: CustomModExpTransactor{contract: contract}, CustomModExpFilterer: CustomModExpFilterer{contract: contract}}, nil
61
+ }
62
+
63
+ // CustomModExp is an auto generated Go binding around an Ethereum contract.
64
+ type CustomModExp struct {
65
+ CustomModExpCaller // Read-only binding to the contract
66
+ CustomModExpTransactor // Write-only binding to the contract
67
+ CustomModExpFilterer // Log filterer for contract events
68
+ }
69
+
70
+ // CustomModExpCaller is an auto generated read-only Go binding around an Ethereum contract.
71
+ type CustomModExpCaller struct {
72
+ contract *bind.BoundContract // Generic contract wrapper for the low level calls
73
+ }
74
+
75
+ // CustomModExpTransactor is an auto generated write-only Go binding around an Ethereum contract.
76
+ type CustomModExpTransactor struct {
77
+ contract *bind.BoundContract // Generic contract wrapper for the low level calls
78
+ }
79
+
80
+ // CustomModExpFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
81
+ type CustomModExpFilterer struct {
82
+ contract *bind.BoundContract // Generic contract wrapper for the low level calls
83
+ }
84
+
85
+ // CustomModExpSession is an auto generated Go binding around an Ethereum contract,
86
+ // with pre-set call and transact options.
87
+ type CustomModExpSession struct {
88
+ Contract *CustomModExp // Generic contract binding to set the session for
89
+ CallOpts bind.CallOpts // Call options to use throughout this session
90
+ TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
91
+ }
92
+
93
+ // CustomModExpCallerSession is an auto generated read-only Go binding around an Ethereum contract,
94
+ // with pre-set call options.
95
+ type CustomModExpCallerSession struct {
96
+ Contract *CustomModExpCaller // Generic contract caller binding to set the session for
97
+ CallOpts bind.CallOpts // Call options to use throughout this session
98
+ }
99
+
100
+ // CustomModExpTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
101
+ // with pre-set transact options.
102
+ type CustomModExpTransactorSession struct {
103
+ Contract *CustomModExpTransactor // Generic contract transactor binding to set the session for
104
+ TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
105
+ }
106
+
107
+ // CustomModExpRaw is an auto generated low-level Go binding around an Ethereum contract.
108
+ type CustomModExpRaw struct {
109
+ Contract *CustomModExp // Generic contract binding to access the raw methods on
110
+ }
111
+
112
+ // CustomModExpCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
113
+ type CustomModExpCallerRaw struct {
114
+ Contract *CustomModExpCaller // Generic read-only contract binding to access the raw methods on
115
+ }
116
+
117
+ // CustomModExpTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
118
+ type CustomModExpTransactorRaw struct {
119
+ Contract *CustomModExpTransactor // Generic write-only contract binding to access the raw methods on
120
+ }
121
+
122
+ // NewCustomModExp creates a new instance of CustomModExp, bound to a specific deployed contract.
123
+ func NewCustomModExp(address common.Address, backend bind.ContractBackend) (*CustomModExp, error) {
124
+ contract, err := bindCustomModExp(address, backend, backend, backend)
125
+ if err != nil {
126
+ return nil, err
127
+ }
128
+ return &CustomModExp{CustomModExpCaller: CustomModExpCaller{contract: contract}, CustomModExpTransactor: CustomModExpTransactor{contract: contract}, CustomModExpFilterer: CustomModExpFilterer{contract: contract}}, nil
129
+ }
130
+
131
+ // NewCustomModExpCaller creates a new read-only instance of CustomModExp, bound to a specific deployed contract.
132
+ func NewCustomModExpCaller(address common.Address, caller bind.ContractCaller) (*CustomModExpCaller, error) {
133
+ contract, err := bindCustomModExp(address, caller, nil, nil)
134
+ if err != nil {
135
+ return nil, err
136
+ }
137
+ return &CustomModExpCaller{contract: contract}, nil
138
+ }
139
+
140
+ // NewCustomModExpTransactor creates a new write-only instance of CustomModExp, bound to a specific deployed contract.
141
+ func NewCustomModExpTransactor(address common.Address, transactor bind.ContractTransactor) (*CustomModExpTransactor, error) {
142
+ contract, err := bindCustomModExp(address, nil, transactor, nil)
143
+ if err != nil {
144
+ return nil, err
145
+ }
146
+ return &CustomModExpTransactor{contract: contract}, nil
147
+ }
148
+
149
+ // NewCustomModExpFilterer creates a new log filterer instance of CustomModExp, bound to a specific deployed contract.
150
+ func NewCustomModExpFilterer(address common.Address, filterer bind.ContractFilterer) (*CustomModExpFilterer, error) {
151
+ contract, err := bindCustomModExp(address, nil, nil, filterer)
152
+ if err != nil {
153
+ return nil, err
154
+ }
155
+ return &CustomModExpFilterer{contract: contract}, nil
156
+ }
157
+
158
+ // bindCustomModExp binds a generic wrapper to an already deployed contract.
159
+ func bindCustomModExp(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
160
+ parsed, err := CustomModExpMetaData.GetAbi()
161
+ if err != nil {
162
+ return nil, err
163
+ }
164
+ return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil
165
+ }
166
+
167
+ // Call invokes the (constant) contract method with params as input values and
168
+ // sets the output to result. The result type might be a single field for simple
169
+ // returns, a slice of interfaces for anonymous returns and a struct for named
170
+ // returns.
171
+ func (_CustomModExp *CustomModExpRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
172
+ return _CustomModExp.Contract.CustomModExpCaller.contract.Call(opts, result, method, params...)
173
+ }
174
+
175
+ // Transfer initiates a plain transaction to move funds to the contract, calling
176
+ // its default method if one is available.
177
+ func (_CustomModExp *CustomModExpRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
178
+ return _CustomModExp.Contract.CustomModExpTransactor.contract.Transfer(opts)
179
+ }
180
+
181
+ // Transact invokes the (paid) contract method with params as input values.
182
+ func (_CustomModExp *CustomModExpRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
183
+ return _CustomModExp.Contract.CustomModExpTransactor.contract.Transact(opts, method, params...)
184
+ }
185
+
186
+ // Call invokes the (constant) contract method with params as input values and
187
+ // sets the output to result. The result type might be a single field for simple
188
+ // returns, a slice of interfaces for anonymous returns and a struct for named
189
+ // returns.
190
+ func (_CustomModExp *CustomModExpCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
191
+ return _CustomModExp.Contract.contract.Call(opts, result, method, params...)
192
+ }
193
+
194
+ // Transfer initiates a plain transaction to move funds to the contract, calling
195
+ // its default method if one is available.
196
+ func (_CustomModExp *CustomModExpTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
197
+ return _CustomModExp.Contract.contract.Transfer(opts)
198
+ }
199
+
200
+ // Transact invokes the (paid) contract method with params as input values.
201
+ func (_CustomModExp *CustomModExpTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
202
+ return _CustomModExp.Contract.contract.Transact(opts, method, params...)
203
+ }
204
+
205
+ // ModExpGeneric is a paid mutator transaction binding the contract method 0xd5665d6f.
206
+ //
207
+ // Solidity: function modExpGeneric(bytes input) returns()
208
+ func (_CustomModExp *CustomModExpTransactor) ModExpGeneric(opts *bind.TransactOpts, input []byte) (*types.Transaction, error) {
209
+ return _CustomModExp.contract.Transact(opts, "modExpGeneric", input)
210
+ }
211
+
212
+ // ModExpGeneric is a paid mutator transaction binding the contract method 0xd5665d6f.
213
+ //
214
+ // Solidity: function modExpGeneric(bytes input) returns()
215
+ func (_CustomModExp *CustomModExpSession) ModExpGeneric(input []byte) (*types.Transaction, error) {
216
+ return _CustomModExp.Contract.ModExpGeneric(&_CustomModExp.TransactOpts, input)
217
+ }
218
+
219
+ // ModExpGeneric is a paid mutator transaction binding the contract method 0xd5665d6f.
220
+ //
221
+ // Solidity: function modExpGeneric(bytes input) returns()
222
+ func (_CustomModExp *CustomModExpTransactorSession) ModExpGeneric(input []byte) (*types.Transaction, error) {
223
+ return _CustomModExp.Contract.ModExpGeneric(&_CustomModExp.TransactOpts, input)
224
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/bin/triggerErrors/triggerErrors.go RENAMED
@@ -32,7 +32,7 @@
32
  // TriggerErrorsMetaData contains all meta data concerning the TriggerErrors contract.
33
  var TriggerErrorsMetaData = &bind.MetaData{
34
  ABI: "[{\"inputs\":[],\"name\":\"count\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfCountersKeccaks\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"test\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfCountersPoseidon\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfCountersSteps\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfGas\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]",
35
- Bin: "0x60806040526000805534801561001457600080fd5b5061016c806100246000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c806306661abd1461005c5780632621002a1461007757806331fe52e8146100835780638bd7b5381461008d578063cb4e8cd114610095575b600080fd5b61006560005481565b60405190815260200160405180910390f35b620f4240600020610065565b61008b61009d565b005b61008b6100c3565b61008b6100e9565b60005b60648110156100c0578060005580806100b89061010d565b9150506100a0565b50565b60005b620186a08110156100c0576104d2600052806100e18161010d565b9150506100c6565b60005b61c3508110156100c0578060005580806101059061010d565b9150506100ec565b600060001982141561012f57634e487b7160e01b600052601160045260246000fd5b506001019056fea264697066735822122097beacfaa873e4896937143dfea406cc278b929a28023f7e7020b6dea6e9fc7364736f6c634300080c0033",
36
  }
37
 
38
  // TriggerErrorsABI is the input ABI used to generate the binding from.
 
32
  // TriggerErrorsMetaData contains all meta data concerning the TriggerErrors contract.
33
  var TriggerErrorsMetaData = &bind.MetaData{
34
  ABI: "[{\"inputs\":[],\"name\":\"count\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfCountersKeccaks\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"test\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfCountersPoseidon\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfCountersSteps\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfGas\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]",
35
+ Bin: "0x60806040526000805534801561001457600080fd5b5061016c806100246000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c806306661abd1461005c5780632621002a1461007757806331fe52e8146100835780638bd7b5381461008d578063cb4e8cd114610095575b600080fd5b61006560005481565b60405190815260200160405180910390f35b620f4240600020610065565b61008b61009d565b005b61008b6100c3565b61008b6100e9565b60005b60648110156100c0578060005580806100b89061010d565b9150506100a0565b50565b60005b620186a08110156100c0576104d2600052806100e18161010d565b9150506100c6565b60005b61c3508110156100c0578060005580806101059061010d565b9150506100ec565b600060001982141561012f57634e487b7160e01b600052601160045260246000fd5b506001019056fea26469706673582212208f01c5dc055b1f376f5da5deb33e2c96ee776174bf48874c5ebba0f606de2ac564736f6c634300080c0033",
36
  }
37
 
38
  // TriggerErrorsABI is the input ABI used to generate the binding from.
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/docker-compose.yml RENAMED
@@ -1,7 +1,7 @@
1
  networks:
2
  default:
3
  name: zkevm
4
-
5
  services:
6
  grafana:
7
  container_name: grafana
@@ -452,7 +452,7 @@
452
 
453
  zkevm-mock-l1-network:
454
  container_name: zkevm-mock-l1-network
455
- image: hermeznetwork/geth-zkevm-contracts:elderberry-fork.9-geth1.13.11
456
  ports:
457
  - 8545:8545
458
  - 8546:8546
@@ -633,7 +633,7 @@
633
  zkevm-sh:
634
  container_name: zkevm-sh
635
  image: zkevm-node
636
- stdin_open: true
637
  tty: true
638
  environment:
639
  - ZKEVM_NODE_STATE_DB_HOST=zkevm-state-db
@@ -643,3 +643,51 @@
643
  - ./config/test.genesis.config.json:/app/genesis.json
644
  command:
645
  - "/bin/sh"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  networks:
2
  default:
3
  name: zkevm
4
+
5
  services:
6
  grafana:
7
  container_name: grafana
 
452
 
453
  zkevm-mock-l1-network:
454
  container_name: zkevm-mock-l1-network
455
+ image: 0xpolygon/cdk-validium-contracts:elderberry-fork.9-geth1.13.11
456
  ports:
457
  - 8545:8545
458
  - 8546:8546
 
633
  zkevm-sh:
634
  container_name: zkevm-sh
635
  image: zkevm-node
636
+ stdin_open: true
637
  tty: true
638
  environment:
639
  - ZKEVM_NODE_STATE_DB_HOST=zkevm-state-db
 
643
  - ./config/test.genesis.config.json:/app/genesis.json
644
  command:
645
  - "/bin/sh"
646
+
647
+ zkevm-node-forced-DAC:
648
+ container_name: zkevm-node-forced-DAC
649
+ image: zkevm-node
650
+ ports:
651
+ - 8125:8125
652
+ environment:
653
+ - ZKEVM_NODE_ISTRUSTEDSEQUENCER=false
654
+ - ZKEVM_NODE_STATEDB_USER=test_user
655
+ - ZKEVM_NODE_STATEDB_PASSWORD=test_password
656
+ - ZKEVM_NODE_STATEDB_NAME=state_db
657
+ - ZKEVM_NODE_STATEDB_HOST=zkevm-permissionless-db
658
+ - ZKEVM_NODE_POOL_DB_USER=test_user
659
+ - ZKEVM_NODE_POOL_DB_PASSWORD=test_password
660
+ - ZKEVM_NODE_POOL_DB_NAME=pool_db
661
+ - ZKEVM_NODE_POOL_DB_HOST=zkevm-permissionless-db
662
+ - ZKEVM_NODE_RPC_PORT=8125
663
+ - ZKEVM_NODE_RPC_SEQUENCERNODEURI=http://zkevm-node-json-rpc:8123
664
+ - ZKEVM_NODE_SYNCHRONIZER_TRUSTEDSEQUENCERURL=http://you-cant-touch-this:8123
665
+ - ZKEVM_NODE_MTCLIENT_URI=zkevm-permissionless-prover:50061
666
+ - ZKEVM_NODE_EXECUTOR_URI=zkevm-permissionless-prover:50071
667
+ volumes:
668
+ - ./config/test.node.config.toml:/app/config.toml
669
+ - ./config/test.genesis.config.json:/app/genesis.json
670
+ command:
671
+ - "/bin/sh"
672
+ - "-c"
673
+ - "/app/zkevm-node run --network custom --custom-network-file /app/genesis.json --cfg /app/config.toml --components \"rpc,synchronizer\""
674
+
675
+ zkevm-data-node-db:
676
+ container_name: zkevm-data-node-db
677
+ restart: unless-stopped
678
+ image: postgres
679
+ healthcheck:
680
+ test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
681
+ interval: 10s
682
+ timeout: 5s
683
+ retries: 5
684
+ ports:
685
+ - 5444:5432
686
+ environment:
687
+ - POSTGRES_USER=committee_user
688
+ - POSTGRES_PASSWORD=committee_password
689
+ - POSTGRES_DB=committee_db
690
+ command:
691
+ - "postgres"
692
+ - "-N"
693
+ - "500"
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/datacommittee_test.go RENAMED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package e2e
2
+
3
+ import (
4
+ "context"
5
+ "crypto/ecdsa"
6
+ "encoding/json"
7
+ "fmt"
8
+ "math/big"
9
+ "os"
10
+ "os/exec"
11
+ "sort"
12
+ "strconv"
13
+ "strings"
14
+ "testing"
15
+ "time"
16
+
17
+ "github.com/0xPolygon/cdk-data-availability/config"
18
+ cTypes "github.com/0xPolygon/cdk-data-availability/config/types"
19
+ "github.com/0xPolygon/cdk-data-availability/db"
20
+ "github.com/0xPolygon/cdk-data-availability/rpc"
21
+ "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygondatacommittee"
22
+ "github.com/0xPolygonHermez/zkevm-node/log"
23
+ "github.com/0xPolygonHermez/zkevm-node/test/operations"
24
+ "github.com/ethereum/go-ethereum"
25
+ eTypes "github.com/ethereum/go-ethereum/core/types"
26
+
27
+ "github.com/ethereum/go-ethereum/accounts/keystore"
28
+ "github.com/ethereum/go-ethereum/common"
29
+ "github.com/ethereum/go-ethereum/crypto"
30
+ "github.com/ethereum/go-ethereum/ethclient"
31
+ "github.com/stretchr/testify/assert"
32
+ "github.com/stretchr/testify/require"
33
+ )
34
+
35
+ func TestDataCommittee(t *testing.T) {
36
+ const (
37
+ nSignatures = 4
38
+ mMembers = 5
39
+ ksFile = "/tmp/pkey"
40
+ cfgFile = "/tmp/dacnodeconfigfile.json"
41
+ ksPass = "pass"
42
+ dacNodeContainer = "hermeznetwork/cdk-data-availability:v0.0.4"
43
+ )
44
+
45
+ // Setup
46
+ var err error
47
+ if testing.Short() {
48
+ t.Skip()
49
+ }
50
+ ctx := context.Background()
51
+ defer func() {
52
+ require.NoError(t, operations.Teardown())
53
+ }()
54
+ err = operations.Teardown()
55
+ require.NoError(t, err)
56
+ opsCfg := operations.GetDefaultOperationsConfig()
57
+ opsCfg.State.MaxCumulativeGasUsed = 80000000000
58
+ opsman, err := operations.NewManager(ctx, opsCfg)
59
+ require.NoError(t, err)
60
+ defer func() {
61
+ require.NoError(t, opsman.StopDACDB())
62
+ }()
63
+ err = opsman.Setup()
64
+ require.NoError(t, err)
65
+ require.NoError(t, opsman.StartDACDB())
66
+ time.Sleep(5 * time.Second)
67
+ authL2, err := operations.GetAuth(operations.DefaultSequencerPrivateKey, operations.DefaultL2ChainID)
68
+ require.NoError(t, err)
69
+ authL1, err := operations.GetAuth(operations.DefaultSequencerPrivateKey, operations.DefaultL1ChainID)
70
+ require.NoError(t, err)
71
+ clientL2, err := ethclient.Dial(operations.DefaultL2NetworkURL)
72
+ require.NoError(t, err)
73
+ clientL1, err := ethclient.Dial(operations.DefaultL1NetworkURL)
74
+ require.NoError(t, err)
75
+ dacSC, err := polygondatacommittee.NewPolygondatacommittee(
76
+ common.HexToAddress(operations.DefaultL1DataCommitteeContract),
77
+ clientL1,
78
+ )
79
+ require.NoError(t, err)
80
+
81
+ // Register committee with N / M signatures
82
+ membs := members{}
83
+ addrsBytes := []byte{}
84
+ urls := []string{}
85
+ for i := 0; i < mMembers; i++ {
86
+ pk, err := crypto.GenerateKey()
87
+ require.NoError(t, err)
88
+ membs = append(membs, member{
89
+ addr: crypto.PubkeyToAddress(pk.PublicKey),
90
+ pk: pk,
91
+ url: fmt.Sprintf("http://cdk-data-availability-%d:420%d", i, i),
92
+ i: i,
93
+ })
94
+ }
95
+ sort.Sort(membs)
96
+ for _, m := range membs {
97
+ addrsBytes = append(addrsBytes, m.addr.Bytes()...)
98
+ urls = append(urls, m.url)
99
+ }
100
+ tx, err := dacSC.SetupCommittee(authL1, big.NewInt(nSignatures), urls, addrsBytes)
101
+ for _, m := range membs {
102
+ fmt.Println(m.addr)
103
+ }
104
+ require.NoError(t, err)
105
+ err = operations.WaitTxToBeMined(ctx, clientL1, tx, operations.DefaultTimeoutTxToBeMined)
106
+ require.NoError(t, err)
107
+
108
+ // Spin up M DAC nodes
109
+ dacNodeConfig := config.Config{
110
+ L1: config.L1Config{
111
+ RpcURL: "http://zkevm-mock-l1-network:8545",
112
+ WsURL: "ws://zkevm-mock-l1-network:8546",
113
+ PolygonValidiumAddress: operations.DefaultL1ZkEVMSmartContract,
114
+ DataCommitteeAddress: operations.DefaultL1DataCommitteeContract,
115
+ Timeout: cTypes.Duration{Duration: time.Second},
116
+ RetryPeriod: cTypes.Duration{Duration: time.Second},
117
+ },
118
+ PrivateKey: cTypes.KeystoreFileConfig{
119
+ Path: ksFile,
120
+ Password: ksPass,
121
+ },
122
+ DB: db.Config{
123
+ Name: "committee_db",
124
+ User: "committee_user",
125
+ Password: "committee_password",
126
+ Host: "zkevm-data-node-db",
127
+ Port: "5432",
128
+ EnableLog: false,
129
+ MaxConns: 10,
130
+ },
131
+ RPC: rpc.Config{
132
+ Host: "0.0.0.0",
133
+ MaxRequestsPerIPAndSecond: 100,
134
+ },
135
+ }
136
+ defer func() {
137
+ // Remove tmp files
138
+ assert.NoError(t,
139
+ exec.Command("rm", cfgFile).Run(),
140
+ )
141
+ assert.NoError(t,
142
+ exec.Command("rmdir", ksFile+"_").Run(),
143
+ )
144
+ assert.NoError(t,
145
+ exec.Command("rm", ksFile).Run(),
146
+ )
147
+ // Stop DAC nodes
148
+ for i := 0; i < mMembers; i++ {
149
+ assert.NoError(t, exec.Command(
150
+ "docker", "kill", "cdk-data-availability-"+strconv.Itoa(i),
151
+ ).Run())
152
+ assert.NoError(t, exec.Command(
153
+ "docker", "rm", "cdk-data-availability-"+strconv.Itoa(i),
154
+ ).Run())
155
+ }
156
+ // Stop permissionless node
157
+ require.NoError(t, opsman.StopPermissionlessNodeForcedToSYncThroughDAC())
158
+ }()
159
+ // Start permissionless node
160
+ require.NoError(t, opsman.StartPermissionlessNodeForcedToSYncThroughDAC())
161
+ // Star DAC nodes
162
+ for _, m := range membs {
163
+ // Set correct port
164
+ port := 4200 + m.i
165
+ dacNodeConfig.RPC.Port = port
166
+ // Write config file
167
+ file, err := json.MarshalIndent(dacNodeConfig, "", " ")
168
+ require.NoError(t, err)
169
+ err = os.WriteFile(cfgFile, file, 0644)
170
+ require.NoError(t, err)
171
+ // Write private key keystore file
172
+ err = createKeyStore(m.pk, ksFile, ksPass)
173
+ require.NoError(t, err)
174
+ // Run DAC node
175
+ cmd := exec.Command(
176
+ "docker", "run", "-d",
177
+ "--name", "cdk-data-availability-"+strconv.Itoa(m.i),
178
+ "-v", cfgFile+":/app/config.json",
179
+ "-v", ksFile+":"+ksFile,
180
+ "--network", "zkevm",
181
+ dacNodeContainer,
182
+ "/bin/sh", "-c",
183
+ "/app/cdk-data-availability run --cfg /app/config.json",
184
+ )
185
+ out, err := cmd.CombinedOutput()
186
+ require.NoError(t, err, string(out))
187
+ log.Infof("DAC node %d started", m.i)
188
+ time.Sleep(time.Second * 5)
189
+ }
190
+
191
+ // Send txs
192
+ nTxs := 10
193
+ amount := big.NewInt(10000)
194
+ toAddress := common.HexToAddress("0x70997970C51812dc3A010C7d01b50e0d17dc79C8")
195
+ _, err = clientL2.BalanceAt(ctx, authL2.From, nil)
196
+ require.NoError(t, err)
197
+ _, err = clientL2.PendingNonceAt(ctx, authL2.From)
198
+ require.NoError(t, err)
199
+
200
+ gasLimit, err := clientL2.EstimateGas(ctx, ethereum.CallMsg{From: authL2.From, To: &toAddress, Value: amount})
201
+ require.NoError(t, err)
202
+
203
+ gasPrice, err := clientL2.SuggestGasPrice(ctx)
204
+ require.NoError(t, err)
205
+
206
+ nonce, err := clientL2.PendingNonceAt(ctx, authL2.From)
207
+ require.NoError(t, err)
208
+
209
+ txs := make([]*eTypes.Transaction, 0, nTxs)
210
+ for i := 0; i < nTxs; i++ {
211
+ tx := eTypes.NewTransaction(nonce+uint64(i), toAddress, amount, gasLimit, gasPrice, nil)
212
+ log.Infof("generating tx %d / %d: %s", i+1, nTxs, tx.Hash().Hex())
213
+ txs = append(txs, tx)
214
+ }
215
+
216
+ // Wait for verification
217
+ _, err = operations.ApplyL2Txs(ctx, txs, authL2, clientL2, operations.VerifiedConfirmationLevel)
218
+ require.NoError(t, err)
219
+
220
+ // Assert that he permissionless node is fully synced (through the DAC)
221
+ time.Sleep(30 * time.Second) // Give some time for the permissionless node to get synced
222
+ clientL2Permissionless, err := ethclient.Dial(operations.PermissionlessL2NetworkURL)
223
+ require.NoError(t, err)
224
+ expectedBlock, err := clientL2.BlockByNumber(ctx, nil)
225
+ require.NoError(t, err)
226
+ actualBlock, err := clientL2Permissionless.BlockByNumber(ctx, nil)
227
+ require.NoError(t, err)
228
+ // je, err := expectedBlock.Header().MarshalJSON()
229
+ // require.NoError(t, err)
230
+ // log.Info(string(je))
231
+ // ja, err := actualBlock.Header().MarshalJSON()
232
+ // require.NoError(t, err)
233
+ // log.Info(string(ja))
234
+ // require.Equal(t, string(je), string(ja))
235
+ require.Equal(t, expectedBlock.Root().Hex(), actualBlock.Root().Hex())
236
+ }
237
+
238
+ type member struct {
239
+ addr common.Address
240
+ pk *ecdsa.PrivateKey
241
+ url string
242
+ i int
243
+ }
244
+ type members []member
245
+
246
+ func (s members) Len() int { return len(s) }
247
+ func (s members) Less(i, j int) bool {
248
+ return strings.ToUpper(s[i].addr.Hex()) < strings.ToUpper(s[j].addr.Hex())
249
+ }
250
+ func (s members) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
251
+
252
+ func createKeyStore(pk *ecdsa.PrivateKey, outputDir, password string) error {
253
+ ks := keystore.NewKeyStore(outputDir+"_", keystore.StandardScryptN, keystore.StandardScryptP)
254
+ _, err := ks.ImportECDSA(pk, password)
255
+ if err != nil {
256
+ return err
257
+ }
258
+ fileNameB, err := exec.Command("ls", outputDir+"_/").CombinedOutput()
259
+ fileName := strings.TrimSuffix(string(fileNameB), "\n")
260
+ if err != nil {
261
+ fmt.Println(fileName)
262
+ return err
263
+ }
264
+ out, err := exec.Command("mv", outputDir+"_/"+fileName, outputDir).CombinedOutput()
265
+ if err != nil {
266
+ fmt.Println(string(out))
267
+ return err
268
+ }
269
+ return nil
270
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/forced_batches_test.go RENAMED
@@ -196,7 +196,7 @@
196
  require.NoError(t, err)
197
  genesisConfig, err := config.LoadGenesisFromJSONString(genesisFileAsStr)
198
  require.NoError(t, err)
199
- require.NoError(t, opsman.SetForkID(genesisConfig.Genesis.BlockNumber, forkID6))
200
  err = opsman.Setup()
201
  require.NoError(t, err)
202
  time.Sleep(5 * time.Second)
 
196
  require.NoError(t, err)
197
  genesisConfig, err := config.LoadGenesisFromJSONString(genesisFileAsStr)
198
  require.NoError(t, err)
199
+ require.NoError(t, opsman.SetForkID(genesisConfig.Genesis.RollupBlockNumber, forkID6))
200
  err = opsman.Setup()
201
  require.NoError(t, err)
202
  time.Sleep(5 * time.Second)
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/forced_batches_vector_shared.go RENAMED
@@ -63,8 +63,8 @@
63
  log.Info("# Setting Genesis #")
64
  log.Info("###################")
65
  genesisActions := vectors.GenerateGenesisActions(testCase.Genesis)
66
- require.NoError(t, opsman.SetGenesis(genesisConfig.Genesis.BlockNumber, genesisActions))
67
- require.NoError(t, opsman.SetForkID(genesisConfig.Genesis.BlockNumber, forkID6))
68
  actualOldStateRoot, err := opsman.State().GetLastStateRoot(ctx, nil)
69
  require.NoError(t, err)
70
  require.NoError(t, opsman.Setup())
 
63
  log.Info("# Setting Genesis #")
64
  log.Info("###################")
65
  genesisActions := vectors.GenerateGenesisActions(testCase.Genesis)
66
+ require.NoError(t, opsman.SetGenesis(genesisConfig.Genesis.RollupBlockNumber, genesisActions))
67
+ require.NoError(t, opsman.SetForkID(genesisConfig.Genesis.RollupBlockNumber, forkID6))
68
  actualOldStateRoot, err := opsman.State().GetLastStateRoot(ctx, nil)
69
  require.NoError(t, err)
70
  require.NoError(t, opsman.Setup())
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/state_test.go RENAMED
@@ -59,7 +59,7 @@
59
  for _, gacc := range testCase.GenesisAccounts {
60
  genesisAccounts[gacc.Address] = gacc.Balance.Int
61
  }
62
- require.NoError(t, opsman.SetGenesisAccountsBalance(genesisConfig.Genesis.BlockNumber, genesisAccounts))
63
 
64
  // Check initial root
65
  require.NoError(t, opsman.CheckVirtualRoot(testCase.ExpectedOldRoot))
 
59
  for _, gacc := range testCase.GenesisAccounts {
60
  genesisAccounts[gacc.Address] = gacc.Balance.Int
61
  }
62
+ require.NoError(t, opsman.SetGenesisAccountsBalance(genesisConfig.Genesis.RollupBlockNumber, genesisAccounts))
63
 
64
  // Check initial root
65
  require.NoError(t, opsman.CheckVirtualRoot(testCase.ExpectedOldRoot))
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/Makefile RENAMED
@@ -26,6 +26,7 @@
26
  DOCKERCOMPOSEZKPROVER := zkevm-prover
27
  DOCKERCOMPOSEPERMISSIONLESSDB := zkevm-permissionless-db
28
  DOCKERCOMPOSEPERMISSIONLESSNODE := zkevm-permissionless-node
 
29
  DOCKERCOMPOSEPERMISSIONLESSZKPROVER := zkevm-permissionless-prover
30
  DOCKERCOMPOSENODEAPPROVE := zkevm-approve
31
  DOCKERCOMPOSENODEAPPROVEV1TOV2 := zkevm-approve-v1tov2
@@ -62,6 +63,7 @@
62
 
63
  RUNPERMISSIONLESSDB := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSDB)
64
  RUNPERMISSIONLESSNODE := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSNODE)
 
65
  RUNPERMISSIONLESSZKPROVER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER)
66
 
67
  RUNAPPROVE := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSENODEAPPROVE)
@@ -101,6 +103,7 @@
101
 
102
  STOPPERMISSIONLESSDB := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSDB) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSDB)
103
  STOPPERMISSIONLESSNODE := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSNODE) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSNODE)
 
104
  STOPPERMISSIONLESSZKPROVER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER)
105
 
106
  STOPAPPROVE := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSENODEAPPROVE) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSENODEAPPROVE)
@@ -110,6 +113,9 @@
110
 
111
  STOP := $(DOCKERCOMPOSE) down --remove-orphans
112
 
 
 
 
113
  .PHONY: test-full-non-e2e
114
  test-full-non-e2e: stop ## Runs non-e2e tests checking race conditions
115
  $(RUNSTATEDB)
@@ -248,6 +254,17 @@
248
  docker logs $(DOCKERCOMPOSEZKPROVER)
249
  trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -failfast -race -v -p 1 -timeout 2000s ../ci/e2e-group11/...
250
 
 
 
 
 
 
 
 
 
 
 
 
251
  .PHONY: benchmark-sequencer-eth-transfers
252
  benchmark-sequencer-eth-transfers: stop
253
  $(RUNL1NETWORK)
@@ -364,7 +381,7 @@
364
  $(STOPZKPROVER)
365
 
366
  .PHONY: run-l1-explorer
367
- run-l1-explorer: ## Runs L1 blockscan explorer
368
  $(RUNEXPLORERL1DB)
369
  $(RUNEXPLORERL1)
370
 
@@ -434,7 +451,7 @@
434
  .PHONY: stop-seqsender-v1tov2
435
  stop-seqsender-v1tov2: ## stops the sequencer sender
436
  $(STOPV1TOV2SEQUENCESENDER)
437
-
438
  .PHONY: run-sync
439
  run-sync: ## runs the synchronizer
440
  $(RUNSYNC)
@@ -498,7 +515,7 @@
498
  .PHONY: stop-eth-tx-manager-v1tov2
499
  stop-eth-tx-manager-v1tov2: ## Stops the eth tx manager service
500
  $(STOPV1TOV2ETHTXMANAGER)
501
-
502
  .PHONY: run-agg
503
  run-agg: ## Runs the aggregator service
504
  $(RUNAGGREGATOR)
@@ -540,7 +557,7 @@
540
  $(RUNPERMISSIONLESSDB)
541
  sleep 3
542
  $(RUNPERMISSIONLESSZKPROVER)
543
-
544
 
545
  PHONY: stop-permissionless-dependencies
546
  stop-permissionless-dependencies: ## Stop the permissionless dependencies (db + prover) without the node
@@ -629,7 +646,7 @@
629
  go run ./scripts/init_network/main.go .
630
 
631
  .PHONY: show-logs
632
- show-logs: ## Show logs for running docker
633
  $(DOCKERCOMPOSE) logs
634
 
635
  .PHONY: deploy-sc
@@ -684,10 +701,12 @@
684
  .PHONY: generate-mocks-synchronizer
685
  generate-mocks-synchronizer: ## Generates mocks for synchronizer , using mockery tool
686
  ## mocks for synchronizer
687
- #export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=EthermanInterface --dir=../synchronizer --output=../synchronizer --outpkg=synchronizer --structname=ethermanMock --filename=mock_etherman.go ${COMMON_MOCKERY_PARAMS}
688
- #export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=stateInterface --dir=../synchronizer --output=../synchronizer --outpkg=synchronizer --structname=StateMock --filename=mock_state.go ${COMMON_MOCKERY_PARAMS}
689
- #export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=ethTxManager --dir=../synchronizer --output=../synchronizer --outpkg=synchronizer --structname=ethTxManagerMock --filename=mock_ethtxmanager.go ${COMMON_MOCKERY_PARAMS}
690
- #export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=poolInterface --dir=../synchronizer --output=../synchronizer --outpkg=synchronizer --structname=poolMock --filename=mock_pool.go ${COMMON_MOCKERY_PARAMS}
 
 
691
  for i in l1RollupProducerInterface l1RollupConsumerInterface worker synchronizerProcessBlockRangeInterface workersInterface L1ParallelEthermanInterface; do \
692
  camelcase=$$(echo $$i | sed 's/\([a-z0-9]\)\([A-Z]\)/\1_\2/g' | tr '[:upper:]' '[:lower:]') ; \
693
  echo $$camelcase ; \
@@ -696,13 +715,13 @@
696
 
697
  rm -Rf ../synchronizer/l2_sync/l2_sync_etrog/mocks
698
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --all --case snake --dir ../synchronizer/l2_sync/l2_sync_etrog --output ../synchronizer/l2_sync/l2_sync_etrog/mocks --outpkg mock_l2_sync_etrog ${COMMON_MOCKERY_PARAMS}
699
-
700
  rm -Rf ../synchronizer/l2_sync/l2_shared/mocks
701
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --all --case snake --dir ../synchronizer/l2_sync/l2_shared --output ../synchronizer/l2_sync/l2_shared/mocks --outpkg mock_l2_shared ${COMMON_MOCKERY_PARAMS}
702
-
703
  rm -Rf ../synchronizer/common/syncinterfaces/mocks
704
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --all --case snake --dir ../synchronizer/common/syncinterfaces --output ../synchronizer/common/syncinterfaces/mocks --outpkg mock_syncinterfaces ${COMMON_MOCKERY_PARAMS}
705
-
706
  rm -Rf ../synchronizer/actions/elderberry/mocks
707
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --all --case snake --dir ../synchronizer/actions/elderberry --output ../synchronizer/actions/elderberry/mocks --outpkg mock_elderberry ${COMMON_MOCKERY_PARAMS}
708
 
@@ -712,8 +731,8 @@
712
 
713
 
714
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=Tx --srcpkg=github.com/jackc/pgx/v4 --output=../synchronizer/mocks --structname=DbTxMock --filename=mock_dbtx.go ${COMMON_MOCKERY_PARAMS}
715
-
716
- .PHONY: generate-mocks-etherman
717
  generate-mocks-etherman: ## Generates mocks for etherman , using mockery tool
718
  ## mocks for etherman
719
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=GasPricer --srcpkg=github.com/ethereum/go-ethereum --output=../etherman --outpkg=etherman --structname=etherscanMock --filename=mock_etherscan.go
@@ -725,7 +744,11 @@
725
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=poolInterface --dir=../gasprice --output=../gasprice --outpkg=gasprice --structname=poolMock --filename=mock_pool.go
726
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=ethermanInterface --dir=../gasprice --output=../gasprice --outpkg=gasprice --structname=ethermanMock --filename=mock_etherman.go
727
 
728
- .PHONY: generate-mocks-aggregator
 
 
 
 
729
  generate-mocks-aggregator: ## Generates mocks for aggregator , using mockery tool
730
  ## mocks for the aggregator tests
731
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=stateInterface --dir=../aggregator --output=../aggregator/mocks --outpkg=mocks --structname=StateMock --filename=mock_state.go
@@ -735,7 +758,7 @@
735
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=aggregatorTxProfitabilityChecker --dir=../aggregator --output=../aggregator/mocks --outpkg=mocks --structname=ProfitabilityCheckerMock --filename=mock_profitabilitychecker.go
736
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=Tx --srcpkg=github.com/jackc/pgx/v4 --output=../aggregator/mocks --outpkg=mocks --structname=DbTxMock --filename=mock_dbtx.go
737
 
738
- .PHONY: generate-mocks-state
739
  generate-mocks-state: ## Generates mocks for state , using mockery tool
740
  ## mocks for the aggregator tests
741
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=storage --dir=../state --output=../state/mocks --outpkg=mocks --structname=StorageMock --filename=mock_storage.go --disable-version-string --with-expecter
@@ -747,6 +770,27 @@
747
  run-benchmarks: run-db ## Runs benchmars
748
  go test -bench=. ./state/tree
749
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
750
  .PHONY: compile-scs
751
  compile-scs: ## Compiles smart contracts, configuration in test/contracts/index.yaml
752
  go run ./scripts/cmd... compilesc --input ./contracts
 
26
  DOCKERCOMPOSEZKPROVER := zkevm-prover
27
  DOCKERCOMPOSEPERMISSIONLESSDB := zkevm-permissionless-db
28
  DOCKERCOMPOSEPERMISSIONLESSNODE := zkevm-permissionless-node
29
+ DOCKERCOMPOSEPERMISSIONLESSNODEDAC := zkevm-node-forced-DAC
30
  DOCKERCOMPOSEPERMISSIONLESSZKPROVER := zkevm-permissionless-prover
31
  DOCKERCOMPOSENODEAPPROVE := zkevm-approve
32
  DOCKERCOMPOSENODEAPPROVEV1TOV2 := zkevm-approve-v1tov2
 
63
 
64
  RUNPERMISSIONLESSDB := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSDB)
65
  RUNPERMISSIONLESSNODE := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSNODE)
66
+ RUNPERMISSIONLESSNODEDAC := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSNODEDAC)
67
  RUNPERMISSIONLESSZKPROVER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER)
68
 
69
  RUNAPPROVE := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSENODEAPPROVE)
 
103
 
104
  STOPPERMISSIONLESSDB := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSDB) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSDB)
105
  STOPPERMISSIONLESSNODE := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSNODE) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSNODE)
106
+ STOPPERMISSIONLESSNODEDAC := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSNODEDAC) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSNODEDAC)
107
  STOPPERMISSIONLESSZKPROVER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER)
108
 
109
  STOPAPPROVE := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSENODEAPPROVE) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSENODEAPPROVE)
 
113
 
114
  STOP := $(DOCKERCOMPOSE) down --remove-orphans
115
 
116
+ RUNDACDB := docker-compose up -d zkevm-data-node-db
117
+ STOPDACDB := docker-compose stop zkevm-data-node-db && docker-compose rm -f zkevm-data-node-db
118
+
119
  .PHONY: test-full-non-e2e
120
  test-full-non-e2e: stop ## Runs non-e2e tests checking race conditions
121
  $(RUNSTATEDB)
 
254
  docker logs $(DOCKERCOMPOSEZKPROVER)
255
  trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -failfast -race -v -p 1 -timeout 2000s ../ci/e2e-group11/...
256
 
257
+ .PHONY: test-e2e-group-cdk-validium-1
258
+ test-e2e-group-cdk-validium-1: stop ## Runs cdk-validium-1 e2e tests checking race conditions
259
+ $(RUNSTATEDB)
260
+ $(RUNPOOLDB)
261
+ $(RUNEVENTDB)
262
+ sleep 5
263
+ $(RUNZKPROVER)
264
+ docker ps -a
265
+ docker logs $(DOCKERCOMPOSEZKPROVER)
266
+ trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -race -v -p 1 -timeout 2000s ../ci/e2e-group-cdk-validium-1/...
267
+
268
  .PHONY: benchmark-sequencer-eth-transfers
269
  benchmark-sequencer-eth-transfers: stop
270
  $(RUNL1NETWORK)
 
381
  $(STOPZKPROVER)
382
 
383
  .PHONY: run-l1-explorer
384
+ run-l1-explorer: ## Runs L1 blockscan explorer
385
  $(RUNEXPLORERL1DB)
386
  $(RUNEXPLORERL1)
387
 
 
451
  .PHONY: stop-seqsender-v1tov2
452
  stop-seqsender-v1tov2: ## stops the sequencer sender
453
  $(STOPV1TOV2SEQUENCESENDER)
454
+
455
  .PHONY: run-sync
456
  run-sync: ## runs the synchronizer
457
  $(RUNSYNC)
 
515
  .PHONY: stop-eth-tx-manager-v1tov2
516
  stop-eth-tx-manager-v1tov2: ## Stops the eth tx manager service
517
  $(STOPV1TOV2ETHTXMANAGER)
518
+
519
  .PHONY: run-agg
520
  run-agg: ## Runs the aggregator service
521
  $(RUNAGGREGATOR)
 
557
  $(RUNPERMISSIONLESSDB)
558
  sleep 3
559
  $(RUNPERMISSIONLESSZKPROVER)
560
+
561
 
562
  PHONY: stop-permissionless-dependencies
563
  stop-permissionless-dependencies: ## Stop the permissionless dependencies (db + prover) without the node
 
646
  go run ./scripts/init_network/main.go .
647
 
648
  .PHONY: show-logs
649
+ show-logs: ## Show logs for running docker
650
  $(DOCKERCOMPOSE) logs
651
 
652
  .PHONY: deploy-sc
 
701
  .PHONY: generate-mocks-synchronizer
702
  generate-mocks-synchronizer: ## Generates mocks for synchronizer , using mockery tool
703
  ## mocks for synchronizer
704
+ export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=EthermanFullInterface --dir=../synchronizer/common/syncinterfaces --output=../synchronizer --outpkg=synchronizer --structname=ethermanMock --filename=mock_etherman.go ${COMMON_MOCKERY_PARAMS}
705
+ export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=StateFullInterface --dir=../synchronizer/common/syncinterfaces --output=../synchronizer --outpkg=synchronizer --structname=StateMock --filename=mock_state.go ${COMMON_MOCKERY_PARAMS}
706
+ export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=EthTxManager --dir=../synchronizer/common/syncinterfaces --output=../synchronizer --outpkg=synchronizer --structname=ethTxManagerMock --filename=mock_ethtxmanager.go ${COMMON_MOCKERY_PARAMS}
707
+ export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=PoolInterface --dir=../synchronizer/common/syncinterfaces --output=../synchronizer --outpkg=synchronizer --structname=poolMock --filename=mock_pool.go ${COMMON_MOCKERY_PARAMS}
708
+ export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=Factory --srcpkg=github.com/0xPolygon/cdk-data-availability/client --output=../synchronizer --outpkg=synchronizer --structname=dataCommitteeClientFactoryMock --filename=mock_datacommitteeclientfactory.go ${COMMON_MOCKERY_PARAMS}
709
+ export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=Client --srcpkg=github.com/0xPolygon/cdk-data-availability/client --output=../synchronizer --outpkg=synchronizer --structname=dataCommitteeClientMock --filename=mock_datacommitteeclient.go ${COMMON_MOCKERY_PARAMS}
710
  for i in l1RollupProducerInterface l1RollupConsumerInterface worker synchronizerProcessBlockRangeInterface workersInterface L1ParallelEthermanInterface; do \
711
  camelcase=$$(echo $$i | sed 's/\([a-z0-9]\)\([A-Z]\)/\1_\2/g' | tr '[:upper:]' '[:lower:]') ; \
712
  echo $$camelcase ; \
 
715
 
716
  rm -Rf ../synchronizer/l2_sync/l2_sync_etrog/mocks
717
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --all --case snake --dir ../synchronizer/l2_sync/l2_sync_etrog --output ../synchronizer/l2_sync/l2_sync_etrog/mocks --outpkg mock_l2_sync_etrog ${COMMON_MOCKERY_PARAMS}
718
+
719
  rm -Rf ../synchronizer/l2_sync/l2_shared/mocks
720
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --all --case snake --dir ../synchronizer/l2_sync/l2_shared --output ../synchronizer/l2_sync/l2_shared/mocks --outpkg mock_l2_shared ${COMMON_MOCKERY_PARAMS}
721
+
722
  rm -Rf ../synchronizer/common/syncinterfaces/mocks
723
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --all --case snake --dir ../synchronizer/common/syncinterfaces --output ../synchronizer/common/syncinterfaces/mocks --outpkg mock_syncinterfaces ${COMMON_MOCKERY_PARAMS}
724
+
725
  rm -Rf ../synchronizer/actions/elderberry/mocks
726
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --all --case snake --dir ../synchronizer/actions/elderberry --output ../synchronizer/actions/elderberry/mocks --outpkg mock_elderberry ${COMMON_MOCKERY_PARAMS}
727
 
 
731
 
732
 
733
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=Tx --srcpkg=github.com/jackc/pgx/v4 --output=../synchronizer/mocks --structname=DbTxMock --filename=mock_dbtx.go ${COMMON_MOCKERY_PARAMS}
734
+
735
+ .PHONY: generate-mocks-etherman
736
  generate-mocks-etherman: ## Generates mocks for etherman , using mockery tool
737
  ## mocks for etherman
738
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=GasPricer --srcpkg=github.com/ethereum/go-ethereum --output=../etherman --outpkg=etherman --structname=etherscanMock --filename=mock_etherscan.go
 
744
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=poolInterface --dir=../gasprice --output=../gasprice --outpkg=gasprice --structname=poolMock --filename=mock_pool.go
745
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=ethermanInterface --dir=../gasprice --output=../gasprice --outpkg=gasprice --structname=ethermanMock --filename=mock_etherman.go
746
 
747
+ export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=dataAvailabilityProvider --dir=../etherman --output=../etherman --outpkg=etherman --structname=daMock --filename=mock_da.go
748
+ export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=stateProvider --dir=../etherman --output=../etherman --outpkg=etherman --structname=stateMock --filename=mock_state.go
749
+
750
+
751
+ .PHONY: generate-mocks-aggregator
752
  generate-mocks-aggregator: ## Generates mocks for aggregator , using mockery tool
753
  ## mocks for the aggregator tests
754
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=stateInterface --dir=../aggregator --output=../aggregator/mocks --outpkg=mocks --structname=StateMock --filename=mock_state.go
 
758
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=aggregatorTxProfitabilityChecker --dir=../aggregator --output=../aggregator/mocks --outpkg=mocks --structname=ProfitabilityCheckerMock --filename=mock_profitabilitychecker.go
759
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=Tx --srcpkg=github.com/jackc/pgx/v4 --output=../aggregator/mocks --outpkg=mocks --structname=DbTxMock --filename=mock_dbtx.go
760
 
761
+ .PHONY: generate-mocks-state
762
  generate-mocks-state: ## Generates mocks for state , using mockery tool
763
  ## mocks for the aggregator tests
764
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=storage --dir=../state --output=../state/mocks --outpkg=mocks --structname=StorageMock --filename=mock_storage.go --disable-version-string --with-expecter
 
770
  run-benchmarks: run-db ## Runs benchmars
771
  go test -bench=. ./state/tree
772
 
773
+ .PHONY: run-dac-db
774
+ run-dac-db: ## Suns the DAC DB
775
+ $(RUNDACDB)
776
+
777
+ .PHONY: stop-dac-db
778
+ stop-dac-db: ## Stops the DAC DB
779
+ $(STOPDACDB)
780
+
781
+ .PHONY: run-permissionless-dac
782
+ run-permissionless-dac: ## Runs a permissionless node that is forced to sync through DAC
783
+ $(RUNPERMISSIONLESSDB)
784
+ sleep 1
785
+ $(RUNPERMISSIONLESSZKPROVER)
786
+ $(RUNPERMISSIONLESSNODEDAC)
787
+
788
+ .PHONY: stop-permissionless-dac
789
+ stop-permissionless-dac: ## Stops the permissionless node that is forced to sync through DAC
790
+ $(STOPPERMISSIONLESSNODEDAC)
791
+ $(STOPPERMISSIONLESSZKPROVER)
792
+ $(STOPPERMISSIONLESSDB)
793
+
794
  .PHONY: compile-scs
795
  compile-scs: ## Compiles smart contracts, configuration in test/contracts/index.yaml
796
  go run ./scripts/cmd... compilesc --input ./contracts
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/operations/manager.go RENAMED
@@ -46,6 +46,7 @@
46
  DefaultL1ZkEVMSmartContract = "0x8dAF17A20c9DBA35f005b6324F493785D239719d"
47
  DefaultL1RollupManagerSmartContract = "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e"
48
  DefaultL1PolSmartContract = "0x5FbDB2315678afecb367f032d93F642f64180aa3"
 
49
  DefaultL1NetworkURL = "http://localhost:8545"
50
  DefaultL1NetworkWebSocketURL = "ws://localhost:8546"
51
  DefaultL1ChainID uint64 = 1337
@@ -263,7 +264,6 @@
263
  if confirmationLevel == PoolConfirmationLevel {
264
  return nil, nil
265
  }
266
-
267
  l2BlockNumbers := make([]*big.Int, 0, len(sentTxs))
268
  for _, tx := range sentTxs {
269
  // check transaction nonce against transaction reported L2 block number
@@ -662,3 +662,23 @@
662
  panic(err)
663
  }
664
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  DefaultL1ZkEVMSmartContract = "0x8dAF17A20c9DBA35f005b6324F493785D239719d"
47
  DefaultL1RollupManagerSmartContract = "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e"
48
  DefaultL1PolSmartContract = "0x5FbDB2315678afecb367f032d93F642f64180aa3"
49
+ DefaultL1DataCommitteeContract = "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE"
50
  DefaultL1NetworkURL = "http://localhost:8545"
51
  DefaultL1NetworkWebSocketURL = "ws://localhost:8546"
52
  DefaultL1ChainID uint64 = 1337
 
264
  if confirmationLevel == PoolConfirmationLevel {
265
  return nil, nil
266
  }
 
267
  l2BlockNumbers := make([]*big.Int, 0, len(sentTxs))
268
  for _, tx := range sentTxs {
269
  // check transaction nonce against transaction reported L2 block number
 
662
  panic(err)
663
  }
664
  }
665
+
666
+ // StartDACDB starts the data availability node DB
667
+ func (m *Manager) StartDACDB() error {
668
+ return StartComponent("dac-db", func() (bool, error) { return true, nil })
669
+ }
670
+
671
+ // StopDACDB stops the data availability node DB
672
+ func (m *Manager) StopDACDB() error {
673
+ return StopComponent("dac-db")
674
+ }
675
+
676
+ // StartPermissionlessNodeForcedToSYncThroughDAC starts a permissionless node that is froced to sync through the DAC
677
+ func (m *Manager) StartPermissionlessNodeForcedToSYncThroughDAC() error {
678
+ return StartComponent("permissionless-dac", func() (bool, error) { return true, nil })
679
+ }
680
+
681
+ // StopPermissionlessNodeForcedToSYncThroughDAC stops the permissionless node that is froced to sync through the DAC
682
+ func (m *Manager) StopPermissionlessNodeForcedToSYncThroughDAC() error {
683
+ return StopComponent("permissionless-dac")
684
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/batchsender/main.go RENAMED
@@ -111,7 +111,7 @@
111
  return err
112
  }
113
 
114
- ethMan, err := etherman.NewClient(cfg.Etherman, cfg.NetworkConfig.L1Config)
115
  if err != nil {
116
  return err
117
  }
@@ -183,7 +183,7 @@
183
  // send to L1
184
  firstSequence := seqs[0]
185
  lastSequence := seqs[len(seqs)-1]
186
- to, data, err := ethMan.BuildSequenceBatchesTxData(auth.From, seqs, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber, auth.From)
187
  if err != nil {
188
  return err
189
  }
 
111
  return err
112
  }
113
 
114
+ ethMan, err := etherman.NewClient(cfg.Etherman, cfg.NetworkConfig.L1Config, nil, nil)
115
  if err != nil {
116
  return err
117
  }
 
183
  // send to L1
184
  firstSequence := seqs[0]
185
  lastSequence := seqs[len(seqs)-1]
186
+ to, data, err := ethMan.BuildSequenceBatchesTxData(auth.From, seqs, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber, auth.From, nil)
187
  if err != nil {
188
  return err
189
  }
{/home/stefan/go/src/Polygon/zkevm-node → .}/tools/state/main.go RENAMED
@@ -32,7 +32,7 @@
32
  networkFlag = cli.StringFlag{
33
  Name: config.FlagNetwork,
34
  Aliases: []string{"net"},
35
- Usage: "Load default network configuration. Supported values: [`mainnet`, `testnet`, `cardona`, `custom`]",
36
  Required: false,
37
  }
38
  customNetworkFlag = cli.StringFlag{
 
32
  networkFlag = cli.StringFlag{
33
  Name: config.FlagNetwork,
34
  Aliases: []string{"net"},
35
+ Usage: "Load default network configuration. Supported values: [`custom`]",
36
  Required: false,
37
  }
38
  customNetworkFlag = cli.StringFlag{
{/home/stefan/go/src/Polygon/zkevm-node → .}/tools/state/reprocess_cmd.go RENAMED
@@ -77,7 +77,7 @@
77
  }
78
 
79
  func newEtherman(c config.Config) (*etherman.Client, error) {
80
- etherman, err := etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config)
81
  if err != nil {
82
  return nil, err
83
  }
 
77
  }
78
 
79
  func newEtherman(c config.Config) (*etherman.Client, error) {
80
+ etherman, err := etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config, nil, nil)
81
  if err != nil {
82
  return nil, err
83
  }